How does the k-means++ initialization algorithm select initial cluster centers?

Last updated 11 November 2026

  • Pick the first center uniformly at random. Then sample each next center with probability proportional to D(x)², its squared distance to the nearest chosen center, until k are chosen.

  • D² sampling spreads seeds into uncovered regions without always grabbing the farthest outlier. It gives an expected O(log k) approximation before running Lloyd iterations.

  • It is the scikit-learn default (init='k-means++'). It remains somewhat outlier-sensitive, and k-means|| is a parallel variant for large data.

  • https://medium.com/@atharv4study/k-means-smarter-initialization-for-better-clustering-6914a473e1c7
  • https://www.geeksforgeeks.org/machine-learning/ml-k-means-algorithm/
  • https://www.bitelrn.com/library/k-means-clustering
All Clustering interview questions