<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I find Euclidean distance of each point from the rest of the points in a group? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-find-Euclidean-distance-of-each-point-from-the-rest-of/m-p/440549#M68908</link>
    <description>&lt;P&gt;Checkout &lt;A href="https://www.jmp.com/support/help/en/16.1/#page/jmp/matrix-functions.shtml?os=win&amp;amp;source=application&amp;amp;utm_source=helpmenu&amp;amp;utm_medium=application#ww4966580" target="_blank" rel="noopener"&gt;KDTable&lt;/A&gt; from Scripting Index to get started&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
tbl = KDTable([1 2, 3 4, 5 6]);
distance = tbl &amp;lt;&amp;lt; Distance between rows(1, 2);
//distance from row 1 to row 2 is: 
Show(distance);
{rows, dist} = tbl &amp;lt;&amp;lt; K nearest rows(2);
Show(rows, dist);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or &lt;A href="https://www.jmp.com/support/help/en/16.1/#page/jmp/matrix-functions.shtml?os=win&amp;amp;source=application&amp;amp;utm_source=helpmenu&amp;amp;utm_medium=application#ww2670326" target="_blank" rel="noopener"&gt;Distance&lt;/A&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
exX1 = [1 2, 3 4, 5 6];
/*Compute squared Euclidean distance*/
exD = Distance(exX1, exX1);
//sqrt(exD);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 29 Nov 2021 19:20:21 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2021-11-29T19:20:21Z</dc:date>
    <item>
      <title>How do I find Euclidean distance of each point from the rest of the points in a group?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-find-Euclidean-distance-of-each-point-from-the-rest-of/m-p/440525#M68905</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a table below. I want to find the distance of each index point from the rest of the index points in the same group formed by combination of Label1 &amp;amp; Label2. For each group (like U1,S1) there are three index points in the table below. I need to calculate distance of point 1 from 2 &amp;amp; 3, 2 from 1 &amp;amp; 3 and 3 from 1 &amp;amp; 2 using X,Y coordinates. Similarly distance should be calculated of each point from the rest of points within the group for other groups as well like (U1,S2), (U2,S1) and (U2,S2). Redundant distance in the same group can be removed like distance of point 1 from 2 is same as 2 from 1.&lt;/P&gt;
&lt;P&gt;My original table has several Label1 (U1,U2,...,U10) and Label2 (S1,S2,...S10). How can I write a jump script (jsl) that reads a table like below and create a column of distances in the same table or a new table. Ultimately I am trying to find the 50 nearest neighbors for each index point within the same group (Un,Sn)&lt;/P&gt;
&lt;P&gt;I will greatly appreciate any guidance. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jmp_question.JPG" style="width: 305px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37963iB82CA0D7623EAF85/image-size/large?v=v2&amp;amp;px=999" role="button" title="jmp_question.JPG" alt="jmp_question.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:41:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-find-Euclidean-distance-of-each-point-from-the-rest-of/m-p/440525#M68905</guid>
      <dc:creator>rverma</dc:creator>
      <dc:date>2023-06-10T23:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I find Euclidean distance of each point from the rest of the points in a group?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-find-Euclidean-distance-of-each-point-from-the-rest-of/m-p/440549#M68908</link>
      <description>&lt;P&gt;Checkout &lt;A href="https://www.jmp.com/support/help/en/16.1/#page/jmp/matrix-functions.shtml?os=win&amp;amp;source=application&amp;amp;utm_source=helpmenu&amp;amp;utm_medium=application#ww4966580" target="_blank" rel="noopener"&gt;KDTable&lt;/A&gt; from Scripting Index to get started&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
tbl = KDTable([1 2, 3 4, 5 6]);
distance = tbl &amp;lt;&amp;lt; Distance between rows(1, 2);
//distance from row 1 to row 2 is: 
Show(distance);
{rows, dist} = tbl &amp;lt;&amp;lt; K nearest rows(2);
Show(rows, dist);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or &lt;A href="https://www.jmp.com/support/help/en/16.1/#page/jmp/matrix-functions.shtml?os=win&amp;amp;source=application&amp;amp;utm_source=helpmenu&amp;amp;utm_medium=application#ww2670326" target="_blank" rel="noopener"&gt;Distance&lt;/A&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
exX1 = [1 2, 3 4, 5 6];
/*Compute squared Euclidean distance*/
exD = Distance(exX1, exX1);
//sqrt(exD);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Nov 2021 19:20:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-find-Euclidean-distance-of-each-point-from-the-rest-of/m-p/440549#M68908</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-11-29T19:20:21Z</dc:date>
    </item>
  </channel>
</rss>

