MACHINE LEARNING • LESSON 2

Supervised Learning

Supervised Learning is a type of Machine Learning where a model learns from examples that already contain the correct answers.

THE CORE IDEA

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.

01

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.

02

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.

03

Features and Labels

In our house example, the information describing the house is called the features.

The actual selling price is the label.

FEATURES Size + Bedrooms + Age
LABEL House Price

The model's job is to learn the relationship between the features and the label.

04

How Does Supervised Learning Work?

The process is easier to understand when we break it into a few simple steps.

1

Give Examples

We provide the model with training data containing features and known answers.

2

Model Makes a Prediction

The model uses the features to produce its own prediction.

3

Compare With the Correct Answer

We compare the model's prediction with the actual known answer.

4

Learn From the Error

The learning algorithm adjusts the model so future predictions can become better.

05

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.

This is the real goal of supervised learning.

Learn from known examples so the model can make useful predictions for new examples.

06

What Happens With a New House?

After training, we give the model information about a house that it has never seen before.

SIZE 2,100 sq ft
BEDROOMS 3
AGE 4 years

We don't give the model the actual selling price. That is what we want the model to predict.

House Features Trained Model Predicted Price

For example, the model might predict:

MODEL PREDICTION $370,000

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.

07

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.

EMAIL INFORMATION Words, links, sender, message length
KNOWN ANSWER Spam / Not Spam

The model learns from these labelled examples.

Later, when a new email arrives, the model can predict whether it is likely to be spam.

08

Two Common Types of Supervised Learning

Supervised learning is mainly used for two common kinds of prediction.

CLASSIFICATION

Predict a Category

The answer belongs to a category.

Example: Spam or Not Spam

REGRESSION

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.

09

Supervised Learning in One Picture

TRAINING DATA Features + Known Labels
LEARNING Model Finds Patterns
NEW DATA Prediction
10

What Makes It "Supervised"?

The simplest way to remember supervised learning is to ask one question:

Do we have the correct answers for the training examples?

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.

KEY IDEA

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.

QUICK CHECK

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.

Answer

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.

NEXT TOPIC

Unsupervised Learning

What happens when we have plenty of data but don't have the correct answers? Next, we will see how Machine Learning can discover patterns without labels.