MACHINE LEARNING • LESSON 8

Classification Examples

Classification is used when a machine learning model needs to decide which category or class a piece of data belongs to. It is used in many real-world problems.

THE SIMPLEST IDEA

Classification answers: "Which category does this belong to?"

The model looks at the features of an input, learns patterns from training examples, and then predicts a category for new data.

01

Example — Spam Email Detection

An email service can use Machine Learning to decide whether a new email is Spam or Not Spam.

The model can learn from information such as:

Number of links
Words used in the email
Email length
Sender information
INPUT Email Data
MODEL Classification
OUTPUT Spam / Not Spam
There are two possible classes, so Spam Detection is a Binary Classification problem.
02

Example — Fraud Detection

Banks and payment systems can use Machine Learning to determine whether a transaction is Fraudulent or Not Fraudulent.

The model can learn patterns from information such as:

Transaction amount
Transaction location
Transaction time
Previous transaction behavior
INPUT Transaction Data
MODEL Classification
OUTPUT Fraud / Not Fraud
Fraud detection is another example of Binary Classification because there are two possible classes.
03

Example — Customer Churn Prediction

A company may want to predict whether a customer is likely to leave its service.

The model can use information such as:

How long the customer has been subscribed
Number of purchases
Customer activity
Previous support interactions
CUSTOMER DATA Features
MODEL Classification
PREDICTION Leave / Stay

The model is not predicting the exact number of days until the customer leaves. It is choosing a category.

"Leave" and "Stay" are two classes, so this is Binary Classification.
04

Example — Image Classification

Machine Learning can also classify images into different categories.

Suppose a model has learned to recognize:

CLASS Cat
CLASS Dog
CLASS Horse
CLASS Bird
INPUT Image
MODEL Image Classification
OUTPUT Dog

If the model can choose between Cat, Dog, Horse, and Bird, this is a Multi-Class Classification problem.

05

Example — Sentiment Classification

Classification can also be used to understand the sentiment of text.

For example, a customer review could be classified as:

CLASS Positive

"The product is excellent."

CLASS Negative

"The product is terrible."

CLASS Neutral

"The product arrived today."

INPUT Customer Review
MODEL Text Classification
OUTPUT Positive
With Positive, Negative, and Neutral classes, this is a Multi-Class Classification problem.
06

Example — Handwritten Digit Recognition

A Machine Learning model can look at an image of a handwritten number and identify which digit it is.

0 1 2 3 4 5 6 7 8 9
INPUT Handwritten Image
MODEL Digit Classification
OUTPUT 7

There are ten possible classes: 0 through 9.

Because there are more than two possible classes, digit recognition is Multi-Class Classification.
07

How to Recognize a Classification Problem

When you see a Machine Learning problem, ask one simple question:

"Am I trying to predict a category?"
WHAT IS THE OUTPUT? A Category
THEN Classification

For example:

Problem Output Type
Spam detection Spam / Not Spam Binary
Fraud detection Fraud / Not Fraud Binary
Animal recognition Cat / Dog / Horse Multi-Class
Sentiment analysis Positive / Negative / Neutral Multi-Class
08

Classification vs Regression

One of the easiest ways to avoid confusion is to look at what the model is trying to predict.

CLASSIFICATION Predicts a category

Example: Spam or Not Spam

REGRESSION Predicts a numerical value

Example: House price = $250,000

Category → Classification. Number → Regression.
REMEMBER THIS

Classification is about choosing a category.

If the output is a category such as Spam, Fraud, Dog, Positive, or 7, the problem may be a classification problem.

Input Data Classification Model Category
QUICK CHECK

Check Your Understanding

Is Spam / Not Spam classification? Yes. It predicts one of two categories.
Is predicting a house price classification? No. A house price is a numerical value, so this is regression.
Is Cat / Dog / Horse classification? Yes. The model chooses one category from several classes.
Is Positive / Negative / Neutral classification? Yes. These are three possible categories.
NEXT TOPIC

Logistic Regression

Next, we will learn about Logistic Regression, a commonly used algorithm for classification.