Unsupervised Learning
Unsupervised Learning
In supervised learning, someone labels the data. In unsupervised learning, there are no labels — the model is given raw data and has to find structure in it on its own.
This is harder, and in some ways more interesting. You're asking the model to discover things you didn't know were there.
Clustering
The most common unsupervised task is clustering — grouping similar things together without being told what the groups should be.
Example: Customer segmentation
A retailer has purchase histories for 2 million customers. They run a clustering algorithm. It finds, say, five natural groups:
- High-spending frequent buyers
- Seasonal shoppers who buy at Christmas
- Price-sensitive deal hunters
- Young subscribers who buy specific categories
- Lapsed customers who haven't bought in 18 months
Nobody told the algorithm these groups exist. It found them. Now the marketing team can tailor campaigns to each group.
Anomaly Detection
Another major use of unsupervised learning is anomaly detection — spotting things that don't fit the pattern.
- Fraud detection: A model learns what "normal" transactions look like. When a transaction deviates significantly (unusual location, unusual amount, unusual merchant type), it flags it.
- Manufacturing: A model learns what normal sensor readings look like on a production line. Deviations indicate a fault.
- Cybersecurity: A model learns normal network traffic patterns. Unusual patterns indicate a potential intrusion.
The model doesn't know what fraud is — it just knows what normal looks like, and surfaces what isn't.
Dimensionality Reduction
Real-world datasets often have hundreds or thousands of features. Dimensionality reduction compresses them into a smaller number of dimensions while keeping the essential structure.
This is useful for:
- Visualisation: Compress 1,000 features down to 2 or 3 so you can plot them and see patterns
- Speeding up training: Fewer features → faster computation
- Removing noise: The compressed representation keeps signal, drops noise
Techniques like PCA (Principal Component Analysis) and t-SNE are widely used.
Supervised vs Unsupervised at a Glance
| Supervised | Unsupervised | |
|---|---|---|
| Labels | Required | None |
| Goal | Predict known outputs | Find hidden structure |
| Example | Spam detection | Customer segmentation |
Sign up free to take the quiz, earn XP, and track your progress.