Picture a student handed thousands of flashcards, each showing a question and its correct answer. After enough corrected examples, they can answer a brand-new question on their own. That is exactly the idea behind supervised learning: a model is trained on labeled data (input expected output) so it can predict the output for new inputs.
The mechanism
Each example is a pair: an input $x$ (an image, a text, some measurements) and a label $y$ (the correct result). The model produces a prediction $\hat{y} = f(x)$, then a loss function measures the gap between $\hat{y}$ and the true value $y$. Training adjusts the parameters to minimize the average error:
$$ \mathcal{L} = \frac{1}{n} \sum_{i=1}^{n} \ell\big(f(x_i),\, y_i\big) $$
The goal is not to memorize but to generalize: to predict well on data never seen before.
Two main families
| Type | Predicted output | Example |
|---|---|---|
| Classification | A category | Spam or not-spam, dog or cat |
| Regression | A continuous value | House price, temperature |
Strengths and limits
- Key strength: high accuracy when labels are plentiful and reliable.
- Cost: labeling is slow and expensive (often human-driven).
- Risk: overfitting, when the model sticks too closely to the training examples and fails in the real world.
Supervised learning = learning by corrected example. No quality labels, no good model.