ML FUNDAMENTALS · 7 MIN
Supervised vs Unsupervised
Supervised learning learns from labelled examples; unsupervised finds structure in unlabelled data.
PIXEL explains
- Supervised: inputs X with known answers y — regression (numbers) or classification (categories).
- Unsupervised: no y — clustering, dimensionality reduction.
- Reinforcement learning learns from rewards through trial and error.
Real world: Labelled: house prices with sizes. Unlabelled: grouping customers by shopping habits.
Code
# Supervised data: (hours_studied, passed)
data = [(1, 0), (2, 0), (4, 1), (6, 1)]
threshold = 3
print([int(h > threshold) for h, _ in data])Output ›
[0, 0, 1, 1]Try it in the online compiler →Checkpoint quiz
Predicting tomorrow's temperature is…