← AI Terminology
K-Means
K-means clusters data into K groups by iteratively assigning points to the nearest centroid and updating centroids to group means.
It is the most widely taught unsupervised clustering algorithm.
It is the most widely taught unsupervised clustering algorithm.
Why It Matters in AI
Segmentation problems are everywhere — customers, embeddings, images. K-means is fast, simple, and a baseline before fancier clustering. Also used to build codebooks and initialise mixture models.
Key Points
| Aspect | Description |
|---|---|
| Need | Choose K; sensitive to scale and init |
| Steps | Assign → update centroids → repeat |
| Limits | Spherical clusters assumption; not hierarchical |
| Related | GMM, DBSCAN, vector quantisation |
| Variants | k-means++, mini-batch k-means |
| Objective | Minimise within-cluster sum of squared distances |
Simple Analogy
Placing K coffee shops so each resident goes to the nearest shop, then moving shops to the centre of their customers until stable.
Common Usage Examples
sklearn.cluster.KMeans(n_clusters=K)- Cluster embedding spaces for analysis
- Customer segmentation baselines
- Elbow/silhouette to pick K
Summary
In short: K-means partitions data into K centroid-based clusters — the default first tool for unsupervised segmentation.