MACHINE LEARNING • LESSON 5

What Are Labels?

A label is the known answer that a Machine Learning model is trained to predict.

THE CORE IDEA

Features tell the model what it knows. The label tells it what it should learn to predict.

In supervised Machine Learning, training examples contain both input information and a known answer.

01

Start With a House Price Example

Suppose we want to build a model that predicts the selling price of a house.

We have historical examples where the actual selling price is already known.

SIZE 1,800 sq ft
BEDROOMS 3
AGE 8 years
PRICE $320,000

Size, bedrooms, and age can be used as features. The actual price is the value we want the model to predict.

02

The Label Is the Known Answer

During training, the model sees examples where the correct answer is already available.

LABEL The known value or category that the model is trained to predict.

The terms label and target are often used interchangeably in Machine Learning.

03

Features vs Label

Consider this simple dataset:

Size Bedrooms Age Price
1800 3 8 $320,000
2200 4 5 $410,000
1400 2 15 $240,000
FEATURES Size + Bedrooms + Age

Information given to the model.

LABEL / TARGET Price

Value the model needs to predict.

04

Labels Can Be Numbers

A label does not have to be a category. It can be a numerical value.

EXAMPLE House Price

$320,000

EXAMPLE Temperature

32°C

When the label is a continuous numerical value, the problem is commonly treated as a regression problem.

05

Labels Can Be Categories

A label can also represent a category or class.

EMAIL Spam

One possible class.

EMAIL Not Spam

Another possible class.

Predicting a category is commonly called a classification problem.

06

Example: Spam Detection

Suppose we have an email dataset.

The features describe the email. The label tells us whether that email was actually spam.

07

Why Does the Model Need Labels?

During supervised learning, the model needs examples where the correct answer is known.

INPUT Features

Information about the example.

MODEL Learn

Compare predictions with known answers.

KNOWN ANSWER Label

The correct result for training.

By comparing its predictions with the known labels, the learning algorithm can adjust the model so that its predictions become more useful.

08

What Happens When We Predict Something New?

Suppose a new house enters the system.

SIZE 2000 sq ft
BEDROOMS 3
AGE 6 years

We give the available features to the trained model.

Features Trained Model Predicted Price

We don't know the actual price yet. That is exactly what we are trying to predict.

09

Training Data Has Labels

Historical training examples normally contain both the input features and their known labels in supervised learning.

FEATURES Size, Bedrooms, Age
LABEL Actual Price
10

Test Data Also Has Known Labels

This is an important distinction.

When we evaluate a model on a test dataset, the test labels are known to us. They are simply hidden from the model during prediction.

Hidden from the model does not mean unknown to us.

We keep the actual answers separate so we can compare the model's predictions against them after prediction.

11

A Common Mistake

Beginners sometimes think the label is simply "the last column" of a dataset.

That's wrong.

A label is defined by the problem you are solving.

The same dataset can have different labels depending on what you want the model to predict.

Example 1

A customer dataset could use next-month spending as the label.

Example 2

The same customer dataset could instead use whether the customer will cancel as the label.

12

Features and Labels Together

FEATURES X

Inputs used by the model.

MODEL Learn

Finds useful patterns.

LABEL y

Known answer we want to predict.

In many Machine Learning libraries and tutorials, X is used for features and y is used for the target or label.

KEY IDEA

Features Are Inputs. Labels Are Answers.

Features describe the examples. Labels provide the known outcomes that a supervised Machine Learning model learns to predict.

QUICK CHECK

Find the Label

You want to predict whether a customer will cancel their subscription.

Your dataset contains:

  • Customer age.
  • Number of months as a customer.
  • Number of support requests.
  • Monthly subscription price.
  • Whether the customer cancelled.
Answer

The first four values can be features.

"Whether the customer cancelled" is the label because that is the outcome we want to predict.

NEXT TOPIC

Features vs Labels

Now let's compare features and labels directly and see how they appear inside a real Machine Learning dataset.