<?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 declutter K Means Cluster in JMP Scripting in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/46227#M26339</link>
    <description>&lt;P&gt;Hello ih,&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp; I will explore this function further.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ry&lt;/P&gt;</description>
    <pubDate>Fri, 20 Oct 2017 23:34:33 GMT</pubDate>
    <dc:creator>RyMcQeN</dc:creator>
    <dc:date>2017-10-20T23:34:33Z</dc:date>
    <item>
      <title>How do I declutter K Means Cluster in JMP Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/45945#M26191</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a JMP script that matches a pair of cartesian coordinate data sets using K Means Cluster.&amp;nbsp; The script works well for data sets that have an equal number of coordinates.&amp;nbsp; I am trying to expand the script to handle scenarios where one of the data sets has missing coordinates or less coordinates than the other.&amp;nbsp; I can&amp;nbsp;do this manually through the K Means Cluster dialog window by first using 'Declutter' then selecting the outliers and excluding them.&amp;nbsp; I would like to automate this process through the JMP script.&amp;nbsp; My plan is to run the 'Declutter' function and limit number of nearest neighbors to 1 then 'Save NN Distances' to a column and exclude the rows that are outside 3 sigma of the mean. Then run the cluster analysis on the remaining coordinates.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure how to do this through JMP scripting.&amp;nbsp; The action of identifying and excluding the outliers by nearest neighbors must happen before the cluster function begins.&amp;nbsp; This is where I am stuck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would it be easier&amp;nbsp;to&amp;nbsp;leave the K Means Cluster dialog up with the Declutter plot and allow the user to&amp;nbsp;highlight the outliers, exclude them, then run the clustering algorithm?&amp;nbsp; If so, is it possible for the script to pause while the user performs these actions then continue after the cluster function is complete? I have additional actions that are performed on the cluster result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a snippet of the K Means Cluster function as I have now.&amp;nbsp; The nClusters variable is defined by the number of rows from the data set with the least number of coordinates.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;obj &lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;=&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt; K Means Cluster&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Y&lt;STRONG&gt;(&lt;/STRONG&gt; &lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;:&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;X&lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;,&lt;/FONT&gt; &lt;FONT color="#000080" face="Consolas" size="2"&gt;:&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;Y&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;Number of Clusters&lt;STRONG&gt;(&lt;/STRONG&gt; nClusters &lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;FONT face="Consolas" size="2"&gt;Columns Scaled Individually&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Consolas" size="2"&gt;0&lt;/FONT&gt;&lt;FONT face="Consolas" size="2"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;obj &amp;lt;&amp;lt; Declutter(1,1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Consolas" size="2"&gt;obj &lt;/FONT&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;&amp;lt;&amp;lt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;Go&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT color="#000080" face="Consolas" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="arial,helvetica,sans-serif" size="3"&gt;&lt;FONT color="#000080"&gt;Any help would be greatly appreciated.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="arial,helvetica,sans-serif" size="3"&gt;&lt;FONT color="#000080"&gt;-Ry&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 22:58:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/45945#M26191</guid>
      <dc:creator>RyMcQeN</dc:creator>
      <dc:date>2017-10-13T22:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I declutter K Means Cluster in JMP Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/46059#M26262</link>
      <description>&lt;P&gt;In JMP 13 I believe you can do this using the screening platform:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//Use sample data
dt = Open( "$SAMPLE_DATA/Cytometry.jmp" );

//Find outliers using KNN
outliers = dt &amp;lt;&amp;lt; Explore Outliers(
	Y( :CD3, :CD8 ),
	Name( "Multivariate k-Nearest Neighbor Outliers" )(K( 1 ))
);

//Save the distance to the nearest point
outliers &amp;lt;&amp;lt; Save NN Distances;

//Make a column indicating that the point is an outlier.  You could skip this and select the points over a certain value directly.
dt &amp;lt;&amp;lt; New Column( "Is Outlier",
	Numeric, "Nominal",
	Formula(
		If(
			:Nearest 1 Distance &amp;gt; Col Mean( :Nearest 1 Distance ) + 3 *
			Col Std Dev( :Nearest 1 Distance ),
			1,
			0
		)
	),
	Value Labels( {0 = "No", 1 = "Yes"} ), Use Value Labels( 1 )
);

//show which points will be excluded
dt &amp;lt;&amp;lt; Graph Builder(
	Show Control Panel( 0 ),
	Variables(
		X( Transform Column( "Row", Formula( Row() ) ) ),
		Y( :Nearest 1 Distance ),
		Color( :Is Outlier )
	),
	Elements( Points( X, Y, Legend( 14 ) ) )
);

//Uncomment to Hide and exclude outliers
//dt &amp;lt;&amp;lt; select where( :Is Outlier == 1 );
//dt &amp;lt;&amp;lt; hide and exclude;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Oct 2017 03:53:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/46059#M26262</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2017-10-18T03:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I declutter K Means Cluster in JMP Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/46086#M26278</link>
      <description>&lt;P&gt;Hello ih,&lt;/P&gt;&lt;P&gt;I'm not sure this function is available in JMP 12 (what I am using).&amp;nbsp; When I test the code you listed, there is no result for the "Explore Outliers" step.&amp;nbsp; Saving NN Distances does not generate a column.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 17:14:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/46086#M26278</guid>
      <dc:creator>RyMcQeN</dc:creator>
      <dc:date>2017-10-18T17:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I declutter K Means Cluster in JMP Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/46116#M26288</link>
      <description>&lt;P&gt;My memory of how that looked in JMP 12 is missing, but John Sall referenced it &lt;A href="https://community.jmp.com/t5/JMP-Blog/Handling-outliers-at-scale/ba-p/30582" target="_self"&gt;here &lt;/A&gt;so I expeect it can be done. Can you check Cols-&amp;gt;Modeling Utilities? Hopefully you can work through the same analysis through the platform.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 23:32:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/46116#M26288</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2017-10-18T23:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I declutter K Means Cluster in JMP Scripting</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/46227#M26339</link>
      <description>&lt;P&gt;Hello ih,&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp; I will explore this function further.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ry&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 23:34:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-declutter-K-Means-Cluster-in-JMP-Scripting/m-p/46227#M26339</guid>
      <dc:creator>RyMcQeN</dc:creator>
      <dc:date>2017-10-20T23:34:33Z</dc:date>
    </item>
  </channel>
</rss>

