<?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: Nearest Neighbor in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/271128#M4016</link>
    <description>&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However wondering is there any technical difficulty (or benefit to not preserve ordering) for SAS to save _N1,_N2,... while preserving the orders?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because the ordered _N1, _N2,... has some benefits, e.g. customized weighted NN and/or easy way to find the optimum K, ...&lt;/P&gt;</description>
    <pubDate>Tue, 17 May 2016 21:54:55 GMT</pubDate>
    <dc:creator>sinmathstat</dc:creator>
    <dc:date>2016-05-17T21:54:55Z</dc:date>
    <item>
      <title>Nearest Neighbor</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/270565#M3997</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to this forum.&lt;/P&gt;&lt;P&gt;I have the following problem in SAS EM. The neighbors out of MBR node have&amp;nbsp;&amp;nbsp;wrong orders. To illustrate the problem I wrote a simple program and I used proc pmbr to do the calculations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t1;
input y x1 x2;
id = _n_;
cards;
1 12 14
1 11 10
0 3 4
0 5 2
;
data t2;
input y x1 x2;

cards;
1 10 12
1 12 12
0 2 1
;
run;

proc dmdb data=t1 dmdbcat=work.temp;
	var  x1 x2;
	class y;
run;

proc pmbr data=t1 dmdbcat=work.temp k=1 method=scan outest=t1_out 
		neighbors ;
	target y;
	id id;
	score outfit=t2_fit data=t2 out=t2_out role=validation;
	
run;

proc print data=t2_out;
run;

proc pmbr data=t1 dmdbcat=work.temp k=2 method=scan outest=t1_out 
		neighbors ;
	target y;
	id id;
	score outfit=t2_fit data=t2 out=t2_out role=validation;
	
run;

proc print data=t2_out;
run;

proc pmbr data=t1 dmdbcat=work.temp k=3 method=scan outest=t1_out 
		neighbors ;
	target y;
	id id;
	score outfit=t2_fit data=t2 out=t2_out role=validation;
	
run;

proc print data=t2_out;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;as you see from the output the orders of neighbors are not correct, i.e. in the first output _n1 is 2 but the second output _n1 is 1. How I can produce the values of _n: in such a way that _n1 shows the first nn , _n2 shows the second nn, ...?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 15 May 2016 04:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/270565#M3997</guid>
      <dc:creator>sinmathstat</dc:creator>
      <dc:date>2016-05-15T04:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Nearest Neighbor</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/270566#M3998</link>
      <description>&lt;P&gt;I can't run those procs because I don't have EM, but couldn't you just sort the output dataset?&lt;/P&gt;</description>
      <pubDate>Sun, 15 May 2016 05:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/270566#M3998</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-15T05:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Nearest Neighbor</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/270728#M4005</link>
      <description>&lt;P&gt;I don't believe there is any ordering implied by the columns _N1, _N2,.. &amp;nbsp;They are just showing the top K nearest neighbors, not necessarily ordered by the nearest to farthest since they all have equal weight when scoring.&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2016 17:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/270728#M4005</guid>
      <dc:creator>WendyCzika</dc:creator>
      <dc:date>2016-05-16T17:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Nearest Neighbor</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/271128#M4016</link>
      <description>&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However wondering is there any technical difficulty (or benefit to not preserve ordering) for SAS to save _N1,_N2,... while preserving the orders?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because the ordered _N1, _N2,... has some benefits, e.g. customized weighted NN and/or easy way to find the optimum K, ...&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2016 21:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/271128#M4016</guid>
      <dc:creator>sinmathstat</dc:creator>
      <dc:date>2016-05-17T21:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Nearest Neighbor</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/271129#M4017</link>
      <description>thanks for your reply.&lt;BR /&gt;&lt;BR /&gt;unfortunately it is not possible to sort them.</description>
      <pubDate>Tue, 17 May 2016 21:55:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Nearest-Neighbor/m-p/271129#M4017</guid>
      <dc:creator>sinmathstat</dc:creator>
      <dc:date>2016-05-17T21:55:45Z</dc:date>
    </item>
  </channel>
</rss>

