Which description matches the standard k-means (Lloyd's) algorithm?
Show the answer and explanation
Correct answer: C, Initialize k centroids, then alternate: assign each point to its nearest centroid and move each centroid to its points' mean.
Explanation Clustering
Lloyd's algorithm for k-means:
- Choose k initial centroids (randomly or with k-means++).
- Assignment step: assign every point to its nearest centroid (squared Euclidean distance).
- Update step: move each centroid to the mean of the points assigned to it.
- Repeat steps 2–3 until the assignments stop changing (or the centroids move less than a tolerance).
Neither step can increase the within-cluster sum of squares, so the algorithm converges, but only to a local optimum that depends on the starting centroids.
Why the other descriptions are different algorithms:
- Merging the closest clusters bottom-up is agglomerative hierarchical clustering.
- Membership probabilities plus covariance updates is EM for a Gaussian mixture model; k-means uses hard assignments and no covariances.
- Core points and density-based growth describe DBSCAN.
Interview tip: name the two alternating steps (assign, update) and mention right away that the result depends on initialization.