| SOM Toolbox | Online documentation | http://www.cis.hut.fi/projects/somtoolbox/ |
[centroids,clusters,err] = kmeans(method, D, n, epochs, verbose)
KMEANS The k-means clustering method.
[centroids,clusters,err] = kmeans(method, D, n, [epochs], [verbose])
C = kmeans('batch',D,10,20);
[C,partition] = kmeans('seq',D,D(1:10,:),20,1);
Input and output arguments ([]'s are optional):
method (string) 'batch' or 'seq'
D (matrix) size dlen x dim, the data
(struct) map or data struct
n (scalar) number of centroids
(matrix) size n x dim, initial values for the centroids
[epochs] (scalar) number of training epochs, 100 by default
[verbose] (scalar) verbose level, 0 by default
centroids (matrix) size n x dim, the k-means centroids
clusters (vector) size dlen x 1, cluster number for each sample
err (scalar) total quantization error for the data set
See also KMEANS_CLUSTERS.