<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi David,<div><br></div><div>Thanks for your reply. &nbsp;Right now I'm using vtkKmeansStatistics without learning and am following the example here:</div><div><br></div><div><a href="http://www.vtk.org/Wiki/VTK/Examples/InfoVis/KMeansClustering">http://www.vtk.org/Wiki/VTK/Examples/InfoVis/KMeansClustering</a></div><div><br></div><div>The output that I get using<span class="Apple-style-span" style="font-family: monospace; white-space: pre; "> kMeansStatistics</span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; "><span class="sy2">-</span></span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; "><span class="sy1">&gt;</span></span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; ">GetOutput</span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; "><span class="br0">(</span></span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; "><span class="br0">)</span></span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; "><span class="sy2">-</span></span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; "><span class="sy1">&gt;</span></span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; ">Dump</span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; "><span class="br0">(</span></span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; "><span class="br0">)</span></span><span class="Apple-style-span" style="font-family: monospace; white-space: pre; "><span class="sy4"> </span></span>shows the original value, the distance to the nearest cluster, and cluster id it is assigned to, instead of the cluster mean.</div><div><br></div><div><div>+-----------------+-----------------+------------------+</div><div>| Magnitude &nbsp; &nbsp; &nbsp; | distance (0) &nbsp; &nbsp;| closest id (0) &nbsp; |</div><div>+-----------------+-----------------+------------------+</div><div>| 0.0657005 &nbsp; &nbsp; &nbsp; | 6.44972e-06 &nbsp; &nbsp; | 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</div><div>| 0.0652216 &nbsp; &nbsp; &nbsp; | 4.24651e-06 &nbsp; &nbsp; | 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</div><div>| 0.0646891 &nbsp; &nbsp; &nbsp; | 2.33557e-06 &nbsp; &nbsp; | 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</div><div>| 0.0641142 &nbsp; &nbsp; &nbsp; | 9.08931e-07 &nbsp; &nbsp; | 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</div><div>| 0.0635069 &nbsp; &nbsp; &nbsp; | 1.19747e-07 &nbsp; &nbsp; | 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</div><div>| 0.0666587 &nbsp; &nbsp; &nbsp; | 1.2235e-05 &nbsp; &nbsp; &nbsp;&nbsp;| 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|</div><div><br></div><div>I think I will probably use learning, but I'd like to get it working without first.</div><div><br></div><div>Thanks,</div><div>Sara&nbsp;</div></div><div><br></div><div><div>On Mar 15, 2011, at 3:27 PM, Thompson, David C wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi Sara,<br><br><blockquote type="cite">I'm using vtkKmeansStatistics to successfully cluster data points.<br></blockquote><blockquote type="cite">However, I'm missing how you access the actual cluster mean values,<br></blockquote><blockquote type="cite">instead of just their labels. &nbsp;It looks like the order of the labels<br></blockquote><blockquote type="cite">may not correspond to the values of the means, is this true?<br></blockquote><br>I'm not clear on what you mean by "label". I've run the filter on data with 2 columns (named x &amp; y) and with 2 sets of initial cluster center coordinates specified on the LEARN_PARAMETERS input: one for k=2 and one for k=3. I get this table:<br><br>+----------------+----------------+----------------+----------------+----------------+----------------+-----------------+<br>| Run ID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| k &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| Iterations &nbsp;&nbsp;&nbsp;&nbsp;| Error &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| Cardinality &nbsp;&nbsp;&nbsp;| x &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| y &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>+----------------+----------------+----------------+----------------+----------------+----------------+-----------------+<br>| 0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 3 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 1528.94 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 772 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 0.166201 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 0.12059 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>| 0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 3 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 0.758854 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 0.855424 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>| 1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 3 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 15 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 381.077 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 198 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 2.99941 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 3.14951 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<br>+----------------+----------------+----------------+----------------+----------------+----------------+-----------------+<br><br>as the first block of output 1 (i.e., GetOutputDataObject( 1 ).GetBlock( 0 ).Dump() will produce the above). The first 2 rows contain the cluster mean values corresponding to the run with k=2 and the final 3 rows have the same for the run with k=3. Because there are 2 coordinates (x &amp; y) for each cluster center, there is no good way to order cluster centers by their means. Instead, their order matches the initial guesses at cluster centers specified on the LEARN_PARAMETERS input if it exists. Otherwise, the order is random because the initial guesses are produced randomly. Is this what you wanted to know?<br><br> &nbsp;&nbsp;&nbsp;David<br></div></blockquote></div><br></body></html>