K-Means Clustering

Category: Foundations of ML/AI

A partitioning algorithm that divides data into K clusters by iteratively assigning points to the nearest centroid and updating centroids.

Full Explanation

K-Means is one of the most widely used clustering algorithms, partitioning N data points into K clusters where each point belongs to the cluster with the nearest mean (centroid). The algorithm alternates between assigning points to their closest centroid and recomputing centroids as the mean of assigned points until convergence. K-means is simple, fast, and scales well to large datasets. The main hyperparameter K (number of clusters) must be specified in advance, and methods like the elbow method or silhouette analysis help determine the optimal K. Limitations include sensitivity to initialization (mitigated by K-means++ initialization), assumption of spherical clusters of similar size, and inability to detect non-convex cluster shapes. K-means is used in customer segmentation, image compression, document clustering, and as a preprocessing step for other algorithms.

Related Terms

More in Foundations of ML/AI

Explore More