Supervised learning
In supervised learning, a model—a program shaped by data—learns patterns from examples that come with supplied answers, then uses what it learned to predict answers on new cases, though not all machine learning works this way.
Learning from examples with known answers.
Think of studying with a stack of practice quizzes that come with an answer key. After checking enough questions against their answers, you are ready to tackle a new test that has no answer key attached.
Supervised learning works in a loosely similar way: a model learns from past examples that pair clues with supplied answers, then uses those patterns on new cases. It is only an analogy—a model does not read or understand questions like a student.
This lesson covers five ideas in order:
- Inputs: the clues supplied to a model when asking it for a guess.
- Target (or label): the recorded answer paired with each past example that we want the model to predict.
- Training: the step where the model learns patterns from past examples that include both inputs and targets.
- Prediction: the model’s estimate for the missing target on a new case (made at prediction time, when the model receives the supplied clues and makes its estimate).
- Other ML methods: why not all machine learning needs supplied labels.
Sam (an invented character for this lesson) helps manage a local community centre’s email inbox. Volunteers sorted past emails as Spam or Not spam so a learned filter can train on them.
For each past email in this small invented dataset, the filter checks three clues: Known sender? (whether the address is in the centre’s address book), Unknown link? (whether it links to an unrecognised website), and Urgent payment? (whether it demands immediate money or gift cards).
| Past email | Known sender? | Unknown link? | Urgent payment? | Target |
|---|---|---|---|---|
| Email 1 | No | Yes | Yes | Spam |
| Email 2 | Yes | No | No | Not spam |
| Email 3 | No | Yes | No | Spam |
| Email 4 | Yes | No | No | Not spam |
| Email 5 | No | No | No | Not spam |
| Email 6 | No | Yes | Yes | Spam |
Notice Email 5: an unknown sender with no suspicious link or payment demand was marked Not spam (a local parent asking about room hire). Learned spam filters typically train on far more than six emails, while some filters rely on hand-written rules instead.

Telling inputs apart from targets.
In Lesson 1.3 you met features (clues) and labels (answers). In supervised learning, those same roles are often called inputs and the target.
Use one simple test to tell them apart: inputs are the clues supplied to the model at prediction time, while the target is the recorded answer you want the model to predict. Not every column in a table is an input—for instance, an email ID such as “Email 1” only identifies the row.
Predicting a category
Checking a bank-card charge as it happens to flag possible fraud.
Inputs: amount, country, time of day.
Target: Fraud or Legitimate recorded on past charges—the model outputs a prediction for each new charge (Lesson 4.3 covers how models turn scores into categories).
Predicting a number
Estimating a flat’s monthly rent before posting a listing.
Inputs: floor area, number of rooms, neighbourhood.
Target: monthly rent recorded in past listings—the model outputs a predicted rent for a new flat (Lesson 4.2 covers predicting numbers).

Walk through Sam’s spam filter.
Many supervised models learn by adjusting internal numbers during training. To keep this walk-through easy to inspect, the lab below uses a simpler example of supervised learning: nearest-match voting.
Here is the rule: compare a new email’s three clues to all six past emails, highlight every past email tied for the highest number of matching clues, let each highlighted past email cast one vote for its own recorded target (Spam or Not spam), and predict whichever category gets more votes. Each separate row gets one vote, even when two rows share identical clues.
A new neighbour emails asking when the centre opens on Saturday, with clues Known sender: No, Unknown link: No, Urgent payment: No. Email 5 matches all 3 clues (every other past email matches at most 2), so Email 5 casts the sole vote for its recorded target and the filter predicts Not spam.
- Start on 1. Spot inputs & target and pick the target for Sam’s spam filter, then try the apartment rent and parcel delivery tasks.
- Switch to 2. Trace a new email and compare New neighbour asking hours with Fake urgent invoice.
- Click Club newsletter with unfamiliar link and notice how a 2–1 vote produces an estimate even when past examples disagree.
- Toggle individual clues yourself, then click Reset walk-through to start fresh.
Prediction time: as each new email arrives in Sam's inbox, the filter must decide whether to move it to the junk folder or keep it in the inbox. The filter supplies the three arrival clues to the model. Which item is the target?
Select one item above to check whether it is the target or an input.
Does all machine learning need labels?
No. Supervised learning is widely used, so it is easy to assume every machine learning system needs a supplied answer key—but it is only one family of learning methods.
Different methods are distinguished by their training signal—the kind of feedback or target the model learns from:
Supervised learning
Learns from examples paired with supplied answers, whether written by people or recorded from past outcomes (like whether a parcel arrived late).
Unsupervised learning
Looks for patterns or groups in inputs without supplied answers, such as grouping customers with similar habits (Lesson 4.4).
Self-supervised learning
Derives its own targets directly from the data itself—for example, hiding part of a sentence and training the model to predict it (Lesson 4.5).
Reinforcement learning
Learns which actions to take from reward or penalty feedback over time rather than a table of supplied answers (Lesson 4.6).

What supervised learning depends on.
Even when you have labeled examples, data quality strongly affects how reliable a supervised model can be.
- Label quality matters: if past emails were mislabeled by mistake, the model can learn misleading patterns.
- Unseen patterns can fool it: if scammers invent a tactic that never appeared in past examples, the filter may miss it.
- Predictions are estimates, not guarantees: a filter can still send a real message to spam or let spam slip through.
- Does “supervised” mean a person checks every prediction live?
No. “Supervised” refers to the supplied answers used during training, not a human approving every prediction afterward.
- Can a target be a number instead of a category?
Yes. When trained on examples with supplied answers, supervised learning can predict either a number (such as monthly rent) or a category (such as Spam or Not spam).
- What if I have lots of data, but no one labeled it?
You can still use machine learning—methods such as unsupervised learning and self-supervised learning do not require supplied answer keys for every example.
Check your understanding.
Take this with you.
Supervised learning learns from supplied answers. During training, the model sees inputs (clues supplied at prediction time) paired with a known target (the answer to predict). On a new case, it takes inputs alone and outputs a prediction—and remember that not all machine learning needs labels.
Ready to continue? Return to How Machines Learn.