Introduction
Imagine walking through a park and noticing that the flowers naturally fall into a few groups by colour and size — without knowing their species names. Grouping similar things together without labels is clustering, the most common unsupervised task.
Clustering is used for:
- customer segmentation — group customers by behaviour to target each group differently;
- data analysis — understand the natural groups in a new dataset;
- dimensionality reduction / feature engineering — describe each example by its similarity to cluster centres;
- anomaly detection — points far from every cluster are unusual;
- semi-supervised learning — label a few examples per cluster and spread the labels;
- image segmentation — group pixels by colour;
- search engines — find images similar to a query.
k-means is the simplest and most popular clustering algorithm: fast, scalable and easy to understand.