Supervised Learning
Supervised Learning is a type of Machine Learning where a model learns from examples that already contain the correct answers.
We show the computer examples with answers, and it learns how to predict the answer for new data.
Think of it like teaching a student using solved examples. The student studies the examples, learns the pattern, and then tries to solve a new problem that they have not seen before.
What Does "Supervised" Mean?
The word supervised means that the learning process has a known answer to learn from.
During training, we give the model two things:
- Input information — the features.
- Correct answer — the label or target.
The model looks at many examples and tries to discover the relationship between the inputs and the correct answers.
A Simple Example: Predicting House Prices
Imagine that we want a computer to predict the price of a house.
We already have information about houses that were sold in the past.
| Size | Bedrooms | Age | Actual Price |
|---|---|---|---|
| 1,500 sq ft | 2 | 10 years | $250,000 |
| 2,000 sq ft | 3 | 5 years | $350,000 |
| 2,500 sq ft | 4 | 3 years | $450,000 |
The model can see that the size, number of bedrooms, and age of the house are related to its price.
The important part is that we already know the actual price for each training example.
Features and Labels
In our house example, the information describing the house is called the features.
The actual selling price is the label.
The model's job is to learn the relationship between the features and the label.
How Does Supervised Learning Work?
The process is easier to understand when we break it into a few simple steps.
Give Examples
We provide the model with training data containing features and known answers.
Model Makes a Prediction
The model uses the features to produce its own prediction.
Compare With the Correct Answer
We compare the model's prediction with the actual known answer.
Learn From the Error
The learning algorithm adjusts the model so future predictions can become better.
Training Is About Learning the Pattern
The model is not supposed to simply memorize the training examples.
It should learn a useful relationship that can also work on examples it has never seen before.
Learn from known examples so the model can make useful predictions for new examples.
What Happens With a New House?
After training, we give the model information about a house that it has never seen before.
We don't give the model the actual selling price. That is what we want the model to predict.
For example, the model might predict:
The exact prediction depends on the data and the model. The important idea is that the model learned from previous houses and is now applying what it learned to a new house.
Another Example: Spam Detection
House prices are one example of supervised learning. Spam detection is another.
Imagine we have thousands of emails that humans have already classified.
The model learns from these labelled examples.
Later, when a new email arrives, the model can predict whether it is likely to be spam.
Two Common Types of Supervised Learning
Supervised learning is mainly used for two common kinds of prediction.
Predict a Category
The answer belongs to a category.
Example: Spam or Not Spam
Predict a Number
The answer is a numerical value.
Example: House price = $370,000
We will study classification and regression in much more detail later in this course.
Supervised Learning in One Picture
What Makes It "Supervised"?
The simplest way to remember supervised learning is to ask one question:
If yes, we can use supervised learning.
For house prices, the correct answer is the actual selling price.
For spam detection, the correct answer is whether the email is spam or not spam.
Supervised Learning Learns From Examples With Known Answers.
We provide features and their correct labels during training. The model learns the relationship between them and uses that learned relationship to predict labels for new data.
Can You Identify Supervised Learning?
A company has thousands of previous customer records. For every customer, it knows whether the customer eventually cancelled their subscription.
The company wants to predict whether a new customer will cancel.
This is supervised learning because the historical examples contain a known answer: whether each customer cancelled.
The model can learn from those examples and then predict the cancellation outcome for a new customer.