Home > Objects > @iData > kmeans.m



[b,c] = kmeans(X, k) : k-means clustering of iData object


function [s,c] = kmeans(a, k, method)


 [b,c] = kmeans(X, k) : k-means clustering of iData object

   @iData/kmeans function to partition the object X into k classes.

   b = kmeans(X,k) partitions the Signal in the iData object X into k clusters.
     The resulting object Signal contains numbers from 1 to 'k' which are indices
     of segments/partitions.
     When no cluster can be found, the result is empty.
   b = kmeans(X)   assumes k=2 partitions

   [b,c] = kmeans(X,k) also returns the centroid of the clusters/partitions/segments.

   b = kmeans(X, k, 'otsu')
     uses the Otsu method, for 2D data sets
   b = kmeans(X, k, 'kmeans++')
     uses the K-means++ method, for 2D data sets

 input:  X: object or array (iData)
         k: number of partitions wanted (integer, default is 2)
         method: '' for default, 'otsu' for Otsu method (only for 2D images).
 output: b: object or array with partition indices (iData)
         c: centroid locations of clusters
 ex:     a=iData(peaks); b=kmeans(a);

 See: https://en.wikipedia.org/wiki/K-means_clustering
 See: https://en.wikipedia.org/wiki/K-means%2B%2B
 See: https://en.wikipedia.org/wiki/Otsu%27s_method

   Otsu N., A threshold selection method from gray-level histogram, IEEE Trans. Syst. Man Cybern. 9:62-66;1979
   [1] J. B. MacQueen, "Some Methods for Classification and Analysis of 
       MultiVariate Observations", in Proc. of the fifth Berkeley
       Symposium on Mathematical Statistics and Probability, L. M. L. Cam
       and J. Neyman, eds., vol. 1, UC Press, 1967, pp. 281-297.
   [2] D. Arthur and S. Vassilvitskii, "k-means++: The Advantages of
       Careful Seeding", Technical Report 2006-13, Stanford InfoLab, 2006.

 Version: Nov. 26, 2018
 See also iData, iData/uminus, iData/abs, iData/real, iData/imag, iData/uplus


This function calls: This function is called by:
Generated on Mon 26-Nov-2018 15:08:42 by m2html © 2005. iFit (c) E.Farhi/ILL EUPL 1.1