MACHINE LEARNING • LESSON 11

What Is Clustering?

Clustering is a machine learning technique that automatically finds groups of similar data. The important part is that we do not give the model the group names beforehand.

THE SIMPLE IDEA

Give the model data, and let it discover which data points belong together.

If some data points are similar, clustering tries to place them in the same group. These groups are called clusters.

01

What Does "Clustering" Mean?

A cluster is simply a group of data points that are similar to each other.

Clustering is the process of finding those groups automatically.

GROUP 1
Similar Data
GROUP 2
Similar Data
GROUP 3
Similar Data
Clustering does not start with predefined groups. It tries to discover the groups from the data itself.
02

A Simple Real-World Example

Imagine an online store has thousands of customers. For each customer, we know:

FEATURE 1 Annual Spending

How much the customer spends.

FEATURE 2 Number of Purchases

How often the customer buys products.

We could have data like this:

CUSTOMER SPENDING PURCHASES
A ₹1,000 2
B ₹1,200 3
C ₹10,000 15
D ₹11,000 17
E ₹2,000 4

We haven't told the machine which customers belong together.

A clustering algorithm can look at the data and discover groups of customers with similar behavior.

03

What Could the Groups Look Like?

The algorithm might discover groups such as:

CLUSTER 1 A, B, E

Customers with relatively low spending and fewer purchases.

CLUSTER 2 C, D

Customers with much higher spending and more purchases.

Notice what happened:

Customer Data Clustering Similar Groups
The algorithm discovered the groups. We did not provide "low customer" or "high customer" labels during training.
04

Clustering Does Not Need Labels

This is one of the most important things to understand.

In classification, the training data already has known answers.

CLASSIFICATION Data + Label

Example: Customer → Premium

CLUSTERING Data Only

The algorithm discovers groups itself.

So with clustering, we don't have something like:

Customer A → Group 1
Customer B → Group 1
Customer C → Group 2

Instead, we give the algorithm the customer information and ask it to find natural groups.

05

How Does Clustering Decide Who Belongs Together?

Clustering algorithms generally look at the similarity or distance between data points.

If two customers have similar spending and purchase behavior, they may be placed in the same cluster.

CUSTOMER A ₹1,000 / 2 purchases
CUSTOMER B ₹1,200 / 3 purchases

These two customers are relatively similar, so a clustering algorithm may place them in the same group.

CUSTOMER A ₹1,000 / 2 purchases
CUSTOMER C ₹10,000 / 15 purchases

These customers are much less similar, so the algorithm may place them in different clusters.

06

Where Is Clustering Used?

Clustering is useful when we have data but don't already know the natural categories inside that data.

EXAMPLE 1 Customer Segmentation

Group customers based on spending and buying behavior.

EXAMPLE 2 Product Grouping

Group similar products based on characteristics such as price, sales, or ratings.

EXAMPLE 3 Document Grouping

Group documents that discuss similar topics.

EXAMPLE 4 Image Grouping

Group visually similar images without manually assigning categories first.

07

Clustering vs Classification

These two ideas sound similar because both can put data into groups. But they work differently.

CLASSIFICATION Known Groups

We already know the categories and provide examples with labels.

Data + Labels → Model → Prediction
CLUSTERING Unknown Groups

We don't provide categories. The algorithm discovers groups from the data.

Data → Algorithm → Groups
Classification predicts a known category. Clustering discovers groups.
REMEMBER THIS

Clustering means finding groups of similar data.

The important difference is that the groups are not given to the model beforehand. The algorithm looks for similarities in the data and creates clusters.

Data Find Similarity Groups
QUICK CHECK

Check Your Understanding

What is clustering? A technique for automatically finding groups of similar data.
What is a cluster? A group of data points that are similar to each other.
Does clustering require labels? No. Clustering normally works with data that does not have predefined labels.
What does clustering try to discover? Natural groups or patterns in the data.
What is the difference from classification? Classification uses known labels; clustering discovers groups.
Give one real-world use. Customer segmentation is one example.
NEXT TOPIC

Supervised vs Unsupervised Learning

Next, we will clearly compare supervised learning, which uses known answers, with unsupervised learning, which finds patterns without predefined answers.