# KMeans, level=beginner

Summary: K-means settled in 2 iterations; the starting centroids were already stable.

[0] init, iteration 0
- The 3 starting centroids are the positions you passed as init. Next, every point will join its nearest centroid.
  (Centroid: the centre of a cluster, at the average position of its points.)

[1] assign, iteration 1
- Every point joined its nearest centroid, giving clusters of 6, 6 and 0 points. The inertia starts at 0.
  (Inertia: the sum of squared distances from every point to its centroid; lower means tighter clusters.)

[2] update, iteration 1
- Cluster 2 has no points and cannot get any: every point already sits exactly on a centroid, because there are fewer distinct points than clusters.
- Centroid 0 was already in the middle of its 6 points.
- Centroid 1 barely moved.
- The inertia stayed at 0.

[3] assign, iteration 2
- No point changed cluster: each one is already with its nearest centroid. The inertia stays at 0.

[4] update, iteration 2
- Cluster 2 has no points and cannot get any: every point already sits exactly on a centroid, because there are fewer distinct points than clusters.
- Centroids 0 and 1 kept the same points, so they stayed put.
- The inertia stayed at 0.

[5] done, iteration 2
- K-means stopped after 2 iterations because no point changed cluster, so another round would change nothing. The final inertia is 0.
  (Iteration: one assignment pass followed by one update pass.)

Diagnostics:
- [step 2] Cluster 2 stayed empty: the data has fewer distinct points than clusters.
  Fix: Use a smaller n_clusters or remove duplicate points.
