2.3 Supervised learning (learning from labeled examples)

Week 2
Pick a depth · ✨ generates it for this lecture

Supervised learning (learning from labeled examples)

The most common and most successful style of machine learning is supervised learning: the model learns from examples where the correct answer is provided.

The setup

You collect a dataset of inputs each paired with its correct output — the label. Photos paired with the animal in them, emails paired with spam/not-spam, houses paired with their sale price. The model's job is to learn the mapping from input to label so well that it can label new, unlabeled inputs correctly. The "supervision" is the labels: like a teacher providing answer keys, they tell the model when it is right or wrong during training.

Two kinds of output

Supervised problems split by what kind of answer they produce.

  • Classification predicts a category from a fixed set. Spam or not-spam. Cat, dog, or bird. Fraudulent or legitimate. The output is a label.
  • Regression predicts a number on a continuous scale. A house's price. Tomorrow's temperature. A patient's expected length of stay. The output is a quantity.

Recognizing which kind of problem you have is the first decision in any supervised project, because it determines the models and the error measures you use.

Why it dominates

Supervised learning powers the majority of deployed AI because most valuable business problems are naturally "given X, predict Y" with historical examples available — past transactions labeled fraud or not, past patients labeled by outcome. Its main cost is labels: someone, or something, must have produced the correct answers to learn from.

A worked example

A bank wants to predict loan default. It gathers thousands of past loans, each labeled "repaid" or "defaulted," with features like income, debt, and credit history. That is a classification problem — two categories. The trained model takes a new applicant's features and outputs a predicted category (or a probability of default). If instead the bank wanted to predict the dollar amount it would recover after a default, that would be regression — a number, not a category.

Tip: highlight any passage above to ask the tutor about it, or to generate practice problems specifically on what you selected.
Ask the tutor for an explanation, a worked example, or a hint. Highlight a passage on the left to ground the question in that text.