The k-means algorithm


This applet demonstrates the k-means algorithm for a 2d feature space. K-means is one of the simplest unsupervised learning algorithms that partition feature vectors into k clusters so that the within group sum of squares is minimized. The procedure follows a simple way to classify a given data set and looks like that:

Step 1: Place ranomly initial group centroids into the 2d space.
Step 2: Assign each object to the group that has the closest centroid.
Step 3: Recalculate the positions of the centroids.
Step 4: If the positions of the centroids didn't change go to the next step, else go to Step 2.
Step 5: End.

How to use the applet

The area surrounded by the black rectangle represents the 2d feature space. You can place a feature vector into this space by a mouse click. When you click the DRAW CLUSTER-Button feature vectors will be placed into the feature space, so that they form gaussian like clusters. The count of the clusters is determined by the choice list on the top right corner.

When you want to start the algorithm press the START-Button. After that the STEP-Button performs one step of the algorihms. You may be interested which step the algorithm execute, therefore the current step is emphasized in the steps framework under the feature space. With the RUN-Button the algorithm runs automatically. If the History Checkbox is enabled you see the way the centroids move.

With the NEW START-Button you can start the algorithm again in step 1 and with the RESTART-Button the feature vectors will be deleted. The list on the top right corner sets the number of the clusters k.






Authors: Jens Spehr and Simon Winkelbach

Other Applets