K-Means Clustering
- Introduced by
- MacQueen, J.
- Year
- 1967
- Type
- Partitional clustering (centroid-based)
What does it do?
K-means partitions observations into a chosen number of groups by minimizing their within-cluster squared distances to cluster means.
Each observation receives a cluster assignment.
The intuition behind the method
Alternate between assigning observations to their nearest centre and recomputing each centre from its assigned observations.
When to use it
Use when a partition based on Euclidean feature geometry is meaningful. Assess whether compact centroid-based groups suit the data and question.
Limitations and considerations
- Initialization can produce different local solutions.
- Unequal density, irregular shapes and outliers can make the resulting partition misleading.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Provides a simple partition and explicit cluster centres.
Applications
- Exploratory grouping and segmentation, with stability and substantive interpretation assessed separately.
How it works
How it works
Choose the number of clusters and an initialization strategy.
Assign each observation to its nearest centroid under squared Euclidean distance.
Recompute centroids and repeat until a stopping condition is reached.
Formula
c_i = \arg\min_{k} \lVert x_i - \mu_k \rVert^2Formula
\mu_k = \frac{1}{|C_k|} \sum_{x_i \in C_k} x_iCommon pitfalls
- Treating a fixed minimum sample size or clusterability threshold as a universal eligibility rule.
- Ignoring feature units. Choose scaling deliberately rather than assuming one preprocessing rule fits every study.
- Interpreting a partition as evidence that natural populations exist.
Related methods
Sources
MacQueen, J. (1967). Some Methods for Classification and Analysis of Multivariate Observations. Proceedings of the 5th Berkeley Symposium on Mathematical Statistics and Probability, 1, 281–297.
Open publication referenceCopied.scikit-learn K-Means Clustering documentation
Open publication referenceCopied.