A short study
k-means
K-means partitions points into k groups by repeatedly making two pencil strokes.
- Assign: give every point to its nearest centroid.
- Average: move each centroid to the mean of its assigned points.
Repeat until the centers stop moving. For this two-dimensional field, each iteration costs roughly
O(nk); after T iterations, the total is
O(nkT).
The result depends on the starting centers. K-means++ spreads those initial choices apart, reducing the odds of a poor local minimum. It does not choose k, resist outliers, or naturally discover curved, unequal, or differently dense groups. Scale matters too: a wide-ranging feature can dominate distance.
Here, every center begins where it was placed. The faint graphite path records its successive means; colored-pencil marks show the current assignments.