oplaTech About Teaching Archive
Oplatek's external memory

K-means trivial matlab implementation

I implemented a simple and heavile commented k-means algorithm example.
With visualisation.

The thing that suprised me, that initialization of Centroids by
randomly choosen input vector is in fact bad idea.
The problem is when the Centroid is set up as a distance outlier
and gets stuck there.

On the other hand, randomly chosen vectors from interval where all the data points are located perform without any such unexpected problems.

The source code is at github.

On of the visualised results for 2D sample inputs
k-means 2D results.