MACHINE LEARNING • LESSON 8

What Is Classification?

Classification is a Machine Learning task where a model predicts which category or class an input belongs to.

THE SIMPLEST DEFINITION

Classification predicts a category instead of a numerical value.

The model looks at the features of an input, learns patterns from training data, and then predicts which class the new input belongs to.

01

What Is Classification?

Classification is used when we want a machine learning model to decide which category an input belongs to.

INPUT Study Hours
MODEL Classification
OUTPUT Pass / Fail

The model is not trying to predict an exact numerical value. It is trying to choose a category.

02

What Is a Class?

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

EMAIL Spam
EMAIL Not Spam
STUDENT Pass
STUDENT Fail

Here, Spam, Not Spam, Pass, and Fail are examples of classes.

A class is a category that the model is trying to predict.
03

Simple Example — Pass or Fail

Suppose we want to predict whether a student will pass an exam based on the number of hours they studied.

Study Hours Result
1 Fail
2 Fail
3 Fail
5 Pass
6 Pass
8 Pass

The model learns patterns from these examples.

NEW STUDENT 6 Hours
CLASSIFICATION MODEL Predict
PREDICTED CLASS Pass
The model predicts the category "Pass", not the student's exact marks.
04

Classification Uses Features and Labels

Classification uses the same basic idea of features and labels that we learned earlier.

FEATURES Study Hours

Information about the student.

CLASSIFICATION MODEL Learn Patterns
LABEL Pass

The category we want to predict.

For classification, the label represents a category such as Pass, Fail, Spam, or Not Spam.

05

Classification vs Regression

This is one of the most important differences to understand.

REGRESSION Predict a number

Example: predict a house price of ₹75,00,000.

CLASSIFICATION Predict a category

Example: predict whether a student will Pass or Fail.

REGRESSION "How much?"

House → ₹75,00,000

CLASSIFICATION "Which category?"

Student → Pass

Regression predicts a numerical value. Classification predicts a class.
06

Real-World Example — Spam Detection

Classification is commonly used to identify whether an email is spam.

The model can use information such as:

Number of links
Number of suspicious words
Email length
Sender information
FEATURES Email Information
CLASSIFICATION Model
CLASS Spam

The possible classes in this example are:

Spam
Not Spam
07

Real-World Example — Fraud Detection

A bank can use classification to determine whether a transaction is potentially fraudulent.

Transaction amount
Location
Transaction time
Previous transaction history
TRANSACTION DATA Features
MODEL Classification
RESULT Fraud / Not Fraud
Fraud and Not Fraud are the classes the model is trying to predict.
08

The Model Learns From Examples

A classification model learns from training examples where the correct class is already known.

TRAINING EXAMPLES Features + Labels
TRAINING Model learns patterns
NEW DATA Features
PREDICTION Class
09

Classification Can Use Probabilities

A classification model may internally estimate how likely each class is.

POSSIBLE CLASS Pass 90%
POSSIBLE CLASS Fail 10%

Based on these probabilities, the model may choose Pass as the predicted class.

We will learn prediction probabilities in detail later in this lesson.
QUICK CHECK

Check Your Understanding

What is classification? A machine learning task that predicts a category or class.
What is a class? A category that an input can belong to.
What does regression predict? A numerical value.
What does classification predict? A category or class.
REMEMBER THIS

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

The model receives features, learns patterns from labeled training data, and predicts a class for new data.

Features Classification Model Class
NEXT TOPIC

Binary Classification

Next, we will learn about classification problems that have exactly two possible classes, such as Pass/Fail and Spam/Not Spam.