Black October, explainedAppsGuidesAI DictionarySmall FixesOn RecordAboutFollow the lab

Supervised learning

Also called learning from examples

Supervised learning teaches a computer with examples that already have the right answer attached, until it can answer new ones by itself.

In plain words

Think of how a child learns fruit. A parent points and says: this is a mango, this is a banana. After enough examples, the child can name a mango they have never seen before.

Supervised learning works the same way. We give the computer thousands of examples, each paired with the right answer, called a label. A photo and the word "mango". An email and the tag "spam". A flat's details and its sale price.

The computer guesses, checks its guess against the answer, and adjusts itself a little. Repeat that millions of times and it gets good at the pattern. Then we use it on new examples that come with no answer. Much of everyday machine learning, like spam filters and photo tagging, is built this way.

Everyday example

Exam prep with an answer key

A student practises with past papers that have the answers at the back. Try a question, flip to the answer, spot the mistake, fix the method. After a hundred papers, the student can handle a fresh question in the real exam. The past papers are the labelled examples, flipping to the answer is the check, and the exam is new data.

Where the example breaks: A student understands why an answer is right. A supervised model only learns which inputs tend to go with which answers, so it can be confidently wrong when new data looks unlike its examples.

Go deeper

How it actually works

Supervised learning is defined by its data: every training example has an input and a known correct output.

  1. Collect labelled examples

    Each example has features (the input, such as a photo's pixels) and a label (the answer). Labels come from people tagging data, from records like past sale prices, or from logs like which emails users marked as spam.

  2. Pick the kind of answer

    If the answer is a category, the task is classification. If it is a number, like a price or tomorrow's rainfall, the task is regression.

  3. Guess, measure, adjust

    The model makes a prediction, and a loss function scores how far it is from the label. Gradient descent then nudges the model's parameters to shrink that score. In a neural network, backpropagation works out which way to nudge each one.

  4. Check on unseen data

    Some labelled examples are held back as a test set. Doing well there, not on the training examples, is what shows the model learned the pattern instead of memorising it.

Core idea
Learn a mapping from inputs to known answers, then apply it to new inputs
Two main task types
Classification (pick a category) and regression (predict a number)
Everyday uses
Spam filters, photo tagging, fraud alerts, price estimates, medical image screening
Inside chatbots
After pre-training, chat models are tuned on example answers written by people, a supervised step (InstructGPT paper, 2022)

The hard part is often not the algorithm but the labels: getting enough correct, consistent answers costs time and money.

Questions people ask

What is the difference between supervised and unsupervised learning?

Supervised learning trains on examples that come with the right answers. Unsupervised learning gets no answers at all and has to find structure on its own, such as groups of similar customers. Supervised is for predicting a known kind of answer; unsupervised is for exploring.

What are examples of supervised learning?

Spam filters (email in, spam or not out), photo apps that recognise faces, bank systems that flag likely fraud, and apps that estimate a house or used car price. In each case the model learned from past examples where the right answer was known.

Is ChatGPT trained with supervised learning?

Partly. The base model learned by self-supervised learning, predicting the next word across huge amounts of text. It was then tuned on good answers written by people, which is supervised, and further with reinforcement learning from human feedback.

Why is it called supervised?

Because the right answers act like a supervisor or teacher. For every training example, the model is told what it should have said, so each mistake can be measured and corrected.

Further reading