K-means Python implementation

The video shows a few runs of the algorithm with some random data. The data is generated by generated by generating a random amount of clusters between (2, k*2), where k is the number of centroids.

The datapoints are then divided into sets belonging to the clusters, and are at a random place within a buffer zone of the cluster point. The buffer zone is defined in random_dataset.py and can be changed easily.

If you are wondering why the circles has some black pixels in them it is because Pygame does not support filled antialiased circles for some reason, so it is the effect of a normal circle with a aa circle drawn over it.

Source download:

Link: k-means.zip

SHA1: 41a14204428aa8db678f8743b27a2c7d45de8870

You will need Pygame in order to run this.

links

social