THE CLUSTER TRIALS
Find the centers
hidden in the crowd.
Place three survey beacons among the observations. Assign each point to its nearest beacon, then move each beacon to its group's average. Reach the error target in six rounds.
Select a beacon, then tap the field to place it. Or use its X/Y controls. Place seeds before starting a run.
Watch the two steps
Assignment changes group membership. Mean update moves the beacons. Both steps are shown separately, so you can see why the error changes.
Why initialization matters
K-means repeatedly assigns points to the nearest center and moves centers to their group's arithmetic mean. It reduces squared error but may settle into a local minimum. A different seed layout can find a better result; a dense small cloud can deserve a center more than a sparse distant outlier.
The actual mljs/kmeans generator computes each assignment and mean update. The target is a feasible reference found from several seeded starts, with a small tolerance; it is not a claimed global optimum. Field coordinates are synthetic observations.
Source: mljs/kmeans · MIT · 105 stars observed 30 October 2026. Pinned 7.0.1 runtime, original field challenges and GPT beacon artwork. License