K-Means & Clustering
Q: How does k-means work and what are its limitations?
Alternate assign (each point → nearest centroid) and update (centroid = mean of its points) until assignments stop changing. Minimizes within-cluster sum of squares; converges to a local optimum.
- Init with k-means++ (spread-out seeds); run several restarts.
- Choose k with the elbow method, silhouette score, or domain needs.
- Limitations: assumes spherical, similarly sized clusters; sensitive to scale (standardize) and outliers.
- Alternatives: GMM (soft assignments, elliptical clusters, EM), DBSCAN (density-based, arbitrary shapes, finds outliers), hierarchical clustering.