Labs · Neural Networks

K-Means Clustering

K-Means Clustering simulation

Not all learning needs labels. K-means finds groups by itself by repeating two steps. (1) Assign: each point joins its nearest centroid. (2) Update: each centroid moves to the mean of its points. Each round can only lower the total squared distance (the inertia), so it is a kind of descent, and it always converges, though not always to the best answer.

The background shows the Voronoi regions: which centroid owns each part of the plane. Bad starting positions can leave a centroid stranded, which is why k-means++ spreads the initial centroids out.

Set K higher than the real number of blobs and watch one blob get split. Click to add points.

Controls

Evolved from Gradient Descent Optimizers.