k-means algorithm (Scripts) Publisher's description
from Tyler London
This function takes as inputs: numPoints: the number of random points to cluster; numClusters: the number of clusters to group the points into
[counter] = kMeans(numPoints, numClusters, shape, drawOn, showOn)
This function takes as inputs: numPoints: the number of random points to cluster; numClusters: the number of clusters to group the points into; shape: a string 'square', 'circle', or 'tube' to carry out the kMeans process in; drawOn: a 1 or 0 indicating whether or not to show the points dynamically joining different clusters (not suitable for more than 500 points) ; showOn: a 1 or 0 indicating whether or not to show the update in clusters as a new figure after each iteration
Given the appropriate parameters kMeans first places k = numClusters random points in the given SHAPE and then carries out the kMeans algorithm. That is, we first assign each of the N = numPoints to the initial mean which is closest (in the standard Euclidean sense), then compute the centroid/center of mass of each cluster and then begin the reassignment process again.
Eventually, the algorithm will stabilize, and plots the final clusters as well as the path that the k means have followed.
System Requirements:MATLAB 7.8 (R2009a)
Program Release Status: New Release
Program Install Support: Install and Uninstall