Imagine handing someone a crate of thousands of unsorted photos with no captions, and simply asking them to group the ones that look alike. That is the wager of unsupervised learning: discovering, on its own, the hidden structure of a dataset that carries no labels. Unlike supervised learning, there is no "right answer" to imitate — the algorithm hunts for regularities by itself.
The core idea
The model receives only inputs $x_1, x_2, \dots, x_n$, with no associated target $y$. Its goal is to model the underlying distribution of the data or reveal its geometry. Two major families dominate:
- clustering: partitioning the data into homogeneous groups;
- dimensionality reduction: compressing information while keeping what matters.
The k-means algorithm, for instance, minimizes the within-cluster distance:
$$ J = \sum_{i=1}^{k} \sum_{x \in C_i} \lVert x - \mu_i \rVert^2 $$
where $\mu_i$ is the centroid of cluster $C_i$.
Real-world uses
| Task | Typical method |
|---|---|
| Customer segmentation | k-means, hierarchical clustering |
| Anomaly detection (fraud) | autoencoders, isolation forest |
| Compression / visualization | PCA, t-SNE, UMAP |
| Recommendation systems | matrix factorization |
Unsupervised learning is also the engine behind the pre-training of large language models, which learn the structure of language from raw, unannotated text.
Strengths and limits
Its main asset: it taps into unlabeled data, which is vastly more abundant and far cheaper. Its difficulty: without ground truth, evaluating result quality stays tricky and often subjective.
Where supervised learning answers a question, unsupervised learning reveals new ones.