Definition
How does your email know what spam looks like?
Supervised learning is machine learning from examples that come with the correct answers, called labels. The model learns to predict the label for new examples. It is the most widely used kind of machine learning.
In simple words
It is like learning with a teacher who marks every answer. Millions of people click "report spam", and each click is a label. The filter learns from those labelled emails and then sorts new emails by itself.
Why it matters
Spam filters, face unlock, price prediction, disease detection from scans and handwriting recognition all use supervised learning. Whenever you can collect examples with known answers, this is usually the first choice.
Key terms
- Supervised learning
- Learning from examples that each come with the correct answer.
- Label
- The correct answer attached to a training example.
- Classification
- Predicting which category an example belongs to.
- Regression
- Predicting a number, such as a price or a temperature.
- Input and output
- What goes into the model (the features) and what should come out (the label).
Explained in detail
Learning with an answer key
The word "supervised" comes from the idea of a supervisor, a teacher who knows the right answers. Each training example is a pair: an input, and the output that is correct for it. A photo and the word "cat". An email and the mark "spam". The details of a house and the price it sold for. The model's task is to learn the link between inputs and outputs so well that it can supply the output for an input it has never seen.
Two kinds of supervised task
If the label is a category, the task is called classification. Is this leaf healthy or diseased? Which of ten digits is written here? Which language is this sentence in? There may be two classes or thousands. If the label is a number, the task is called regression. How many units will the shop sell next week? How many minutes until the bus arrives? What will the temperature be at noon? The methods are closely related, but the outputs are judged differently: a classification is right or wrong, while a regression is judged by how far off it was.
| Question | Kind of task | Label |
|---|---|---|
| Is this payment fraudulent? | Classification | Fraud or genuine |
| Which crop disease is in this photo? | Classification | The name of the disease |
| How much rain will fall tomorrow? | Regression | Millimetres of rain |
| How long will this journey take? | Regression | Minutes |
Where the answers come from
Supervised learning needs a large supply of correct answers, and getting them is often the hardest part of a project. There are three common sources. Records of the past already contain the outcome: a bank knows which loans were repaid, and a weather office knows how much rain actually fell. Users provide labels as they use a product, by marking spam or rating a film. And where neither exists, people are employed to label data by hand, which is slow and costly, especially when experts such as doctors are needed.
Strengths and limits
Supervised learning is the most widely used kind of machine learning because it is direct: you show the model exactly what you want. Its results are also easy to measure, because you can compare predictions with known answers. Its limits follow from its dependence on labels. It can only learn the task the labels describe. It cannot be better than its labels: if the people who labelled the data made mistakes or held prejudices, the model learns those as well. And it can predict only the classes it was shown. A model trained on apples and oranges has no way to answer "banana".
How it works
| Task | Example | Label |
|---|---|---|
| Spam filter | An email | Spam or not spam |
| Face unlock | A photo of a face | Owner or not owner |
| House price | Size, area, rooms | The price it sold for |
When the label is a category, such as spam or not spam, the task is called classification. When it is a number, such as a price, it is called regression.
Try it yourself
Learning with an answer key
Follow a teacher marking a student's work. Supervised learning works the same way.
Is this supervised learning?
Does each task learn from examples that come with the right answers?
Reading handwritten numbers using examples marked 0 to 9
Learning to spot spam from emails people marked as spam
Grouping customers by shopping habits with no labels
Predicting tomorrow's bus arrival from past times
A robot learning to walk from rewards for each step
Common mistakes
- Thinking supervised means a person watches the model all the time. It means the examples have labels.
- Forgetting that labels must be correct. Wrong labels teach wrong answers.
- Mixing up classification and regression.
Check yourself
Summary
- Supervised learning learns from labelled examples.
- Categories are classification; numbers are regression.
- It powers spam filters, face unlock and price prediction.
Finished reading?
Sources: Google Machine Learning Crash Course