MACHINE LEARNING • LESSON 2

Classification Problems

A classification problem asks a Machine Learning model to determine which category an example belongs to.

THE CORE IDEA

Instead of predicting a number, we choose a category.

The model learns from previous examples and uses what it learned to assign a new example to one of the available categories.

01

What Is a Category?

A category is a group or class that an example can belong to.

EMAIL Spam

The email belongs to the spam category.

EMAIL Not Spam

The email belongs to the normal-email category.

CUSTOMER Will Buy

The customer is predicted to purchase.

CUSTOMER Will Not Buy

The customer is predicted not to purchase.

02

The Basic Classification Structure

INPUT Information

Information about the example.

MODEL Learned Pattern

Uses patterns learned from previous examples.

OUTPUT Category

The predicted class.

03

Example: Spam Detection

Spam detection is one of the easiest examples for understanding classification.

INPUT Email information

Words, sender information, links, and other available information.

MODEL Spam classifier

Uses patterns learned from previous emails.

OUTPUT Spam

The predicted category.

04

The Model Learns From Examples

During training, we provide examples where the correct category is already known.

EMAIL 1 "You won a free prize!"

Category: Spam

EMAIL 2 "Your order has shipped"

Category: Not Spam

EMAIL 3 "Claim your reward now"

Category: Spam

The model learns from the relationship between the input and the known category.

Later, when it receives a new email, it can use the learned patterns to predict its category.

05

Binary Classification

When there are only two possible categories, the problem is called binary classification.

CATEGORY 1 Spam
VS
CATEGORY 2 Not Spam

Another example is predicting whether a customer will buy or will not buy.

06

More Than Two Categories

Classification does not have to contain only two categories. A problem can have several possible classes.

CATEGORY Cat
CATEGORY Dog
CATEGORY Bird
CATEGORY Horse

If the model must choose between several possible categories, we have a multiclass classification problem.

07

Classification vs Numerical Prediction

The easiest way to distinguish classification from numerical prediction is to look at the type of output we want.

CLASSIFICATION Category

Example: Spam or Not Spam.

NUMERICAL PREDICTION Number

Example: House price = $420,000.

08

Real-World Classification Examples

EMAIL Spam detection

Spam / Not Spam.

FINANCE Fraud detection

Fraudulent / Legitimate.

CUSTOMER Purchase prediction

Will Buy / Will Not Buy.

IMAGE Image recognition

Cat / Dog / Bird / Other class.

09

Classification Is Still a Prediction

Classification and numerical prediction may look different, but both are prediction problems.

PREDICTION General idea

Estimate an unknown outcome from known information.

CLASSIFICATION Predict a category

The output belongs to one of the available classes.

KEY IDEA

Classification Predicts a Category

A classification model learns from labeled examples and predicts which category a new example belongs to.

QUICK CHECK

Is This Classification?

Predict whether an email is spam.

Yes. The output is a category: Spam or Not Spam.

Predict the price of a house.

No. The output is a numerical value.

Predict whether a transaction is fraudulent.

Yes. The output can be Fraudulent or Legitimate.

NEXT TOPIC

Grouping Problems

Not every ML problem has known categories. Next, we'll look at problems where the system discovers groups in the data by itself.