This is a very fast implementation of the original kmeans clustering algorithm without any fancy acceleration technique, such as kd-tree indexing and triangular inequation. (actually the fastest matlab implementation as far as I can tell.)
This code is as vectorized as possible. Yet it is very compact (only 10 lines of code). It is 10~100 times faster than the kmeans function in matlab.
The package also includes a function for ploting the data with labels.
Sample code:
>> load data;spread(x,y)
>> label = litekmeans(x,3);spread(x,label )
Detail explanation of this algorithm can be found in following blog post:
http://statinfer.wordpress.com/2011/12/12/efficient-matlab-ii-kmeans-clustering-algorithm/ |