In supervised learning, you have labels. In unsupervised learning, you don't — you just have data, and the goal is to find hidden structure or patterns.
Common tasks:
You already know K-Means from the problem bank! Let's see it in action on a simple dataset.
Run the code to cluster 2D points into 3 groups:
Notice that we never told the algorithm which points belong to which group — it figured out the structure on its own. That's the power of unsupervised learning.
| Supervised | Unsupervised | |
|---|---|---|
| **Data** | Labeled (X, y) | Unlabeled (X only) |
| **Goal** | Predict y for new X | Find patterns in X |
| **Evaluation** | Compare predictions to true labels | Harder — domain knowledge needed |
| **Examples** | Classification, regression | Clustering, PCA, anomaly detection |