Machine Learning

k-Means

Pick k centers, colour each point by its nearest one, then move each center to the average of its points. Repeat. Step through it by hand, or throw your own points onto the canvas and watch the loop sort them out.

Iteration0
Inertia
Status

Click the canvas to drop your own points. Clear to start from an empty board.

What to observe

  1. One Step is one full round: recolor every point to its nearest center, then slide each center to the mean of its color. Watch the two halves of the loop take turns.
  2. Hit New centers a few times on the same points: k-means can settle into different groupings depending on where it started. It finds a local optimum, not the global one.
  3. Switch to Moons, or draw two crescents by hand. k-means insists on round, straight-edged clusters and splits them wrongly, exactly the blind spot DBSCAN fixes.

Shortcuts: space run/pause · s step · r reset · f fullscreen