Skip to main content

Command Palette

Search for a command to run...

♨️ Unsupervised Machine Learning

Published
•6 min read•View as Markdown
♨️ Unsupervised Machine Learning

📑 Index

  • Introduction – Why Unsupervised Learning Matters

  • What is Unsupervised Machine Learning?

  • Major Types of Unsupervised Learning

  • Why Clustering is So Important

  • What is Clustering?

  • A Real-World Case Study – Bank Customer Segmentation

  • Clustering as an Unsupervised Learning Problem

  • Applications of Clustering in Real Life

  • Properties of Good Clusters

  • Understanding Inertia

  • Main Types of Clustering Algorithms

  • Introduction to K-Means Clustering

  • Step-by-Step Working of K-Means

  • Final Thoughts & Conclusion


Introduction – Why Unsupervised Learning Matters

In the real world, most of the data we collect does not come with labels.

For example:

  • No one tells us which customers are high value or *low value.

  • No one marks which users are similar to each other.

  • No one defines which documents belong to which topic.

This is exactly where Unsupervised Machine Learning becomes powerful.

It helps us answer one simple but important question:

What patterns are hidden inside my data?

👉 Yahi toh real data science hai – data ko samajhna, bina kisi answer key ke.


What is Unsupervised Machine Learning?

Unsupervised learning is a machine learning approach where:

  • there is no target variable

  • we only have input features

  • the algorithm tries to discover structure, patterns and relationships

In short:

Data bolta hai, model sirf sunta hai.


Major Types of Unsupervised Learning

Let us first understand the three most common approaches.


1️⃣ Dimensionality Reduction (PCA, t-SNE)

The goal of dimensionality reduction is to:

  • reduce the number of features

  • while preserving the important information

Simple example

If you have 100 features describing a customer, you can compress them into 2 or 3 meaningful dimensions and visualize them in 2D.

It is extremely useful for:

  • data visualization

  • noise reduction

  • faster and simpler models


2️⃣ Clustering (K-Means, Hierarchical)

Clustering groups similar data points together.

Example

Grouping customers with similar income, spending behaviour and debt patterns.

This is one of the most widely used unsupervised techniques.


3️⃣ Association (Apriori, FP-Growth)

Association rules discover relationships such as:

Customers who buy X also buy Y.

This is commonly used in:

  • market basket analysis

  • recommendation systems


Among all of these, clustering is one of the most practical and widely used techniques to uncover natural groupings in data.


Why Clustering is So Important

Whenever you want to:

  • segment customers

  • group users

  • organise documents

  • identify similar products

clustering becomes your first choice.

In simple words:

Clustering turns unorganised data into meaningful groups.


What is Clustering?

Clustering is the process of organising data points into groups (called clusters) such that:

  • data points inside the same cluster are similar

  • data points in different clusters are dissimilar

Think of it like organising a cupboard:

  • shirts together

  • t-shirts together

  • jackets together

Same concept – but with data.


A Real-World Case Study – Bank Customer Segmentation

Let us take a very realistic example.

A bank wants to give credit card offers to its customers.

Currently, the bank looks at:

  • customer income

  • debt

  • spending behaviour

and then decides which offer should be given.

But now imagine:

👉 the bank has millions of customers.

Does it make sense to analyse every customer manually?

Certainly not.

This is where clustering becomes extremely useful.

The bank can automatically group customers based on:

  • income

  • debt

  • spending behaviour

Once clusters are created, the bank can design separate strategies for each group.

👉 Yahin se business value create hoti hai.


Clustering as an Unsupervised Learning Problem

In clustering:

  • there is no target variable

  • there is no predefined label

We only have independent variables.

The algorithm looks at the data and tries to form groups of similar observations.

That is why:

Clustering is an unsupervised learning problem.


Applications of Clustering in Real Life

✅ Customer Segmentation

Group customers based on purchasing behaviour to personalise marketing.

Example: E-commerce platforms such as Amazon.


✅ Market Basket Analysis

Identify product groupings that are often bought together.

Example: Retail chains optimising store layouts.


✅ Image Segmentation

Divide an image into meaningful regions.

Example: Medical imaging to detect tumours.


✅ Social Network Analysis

Find communities and influencer groups.

Example: LinkedIn or Facebook community detection.


✅ Anomaly Detection

Detect unusual or suspicious patterns.

Example: Credit card fraud detection.


✅ Document and News Categorisation

Group similar articles and documents.

Example: Google News clustering similar topics.


Properties of Good Clusters

Let us again take the bank example.

Assume we use only:

  • income (x-axis)

  • debt (y-axis)

What makes a good cluster?


Property 1 – Similarity within a cluster

All data points inside one cluster should be similar to each other.

If customers inside one cluster are very different, their needs will also be different.

Giving them the same offer may reduce customer satisfaction.

👉 Simple baat – jo log alag-alag ho, unko ek hi offer dena sahi nahi hota.


Property 2 – Dissimilarity across clusters

Data points from different clusters should be as different as possible.

If two clusters contain almost the same type of customers, then the clustering is not meaningful.

Good clustering clearly separates:

  • high income – high debt customers

  • high income – low debt customers


Understanding Inertia

Inertia measures how close the data points inside a cluster are to each other.

More formally, inertia is:

the sum of distances of all points from the centroid of their cluster.

This distance inside a cluster is called intra-cluster distance.

Lower inertia indicates:

  • tighter clusters

  • better internal similarity


Main Types of Clustering Algorithms

TypeExample AlgorithmKey IdeaUse When
Partitioning basedK-MeansMinimises distance between points and centroidsYou already know the number of clusters
Hierarchical basedAgglomerativeBuilds a tree-like cluster structureYou want to see hierarchy of clusters

Introduction to K-Means Clustering

K-Means is one of the most popular clustering algorithms.

It is:

  • centroid-based

  • distance-based

Each cluster is represented by a centroid.

The objective of K-Means is very simple:

To minimise the sum of distances between data points and their respective cluster centroids.

👉 Bas itna yaad rakho – har point ko uske closest centre ke paas le jaana.


Step-by-Step Working of K-Means

The working of the K-Means algorithm can be explained in the following steps.

  1. Select the number of clusters K.

  2. Select K random points as initial centroids.

  3. Assign each data point to its closest centroid.

  4. Recalculate the centroid of each cluster by taking the mean of all assigned points.

  5. Reassign each data point to the nearest newly calculated centroid.

  6. Repeat steps 4 and 5 until no reassignment happens.

  7. The final clusters are obtained.

At this point, the algorithm has converged.


Final Thoughts & Conclusion

In real-world projects, labelled data is rare and expensive.

Unsupervised learning helps us explore data and discover hidden structure without any predefined answers.

Among all unsupervised techniques, clustering is one of the most business-friendly and practical methods.

From banking and retail to healthcare and social networks, clustering enables organisations to:

  • understand their users

  • create meaningful segments

  • design better strategies

K-Means, because of its simplicity and efficiency, is usually the first algorithm used to explore unknown data.

End mein sirf ek hi baat yaad rakho:

  • Unsupervised learning data ko samajhne ka tareeka hai.

  • Clustering data ko meaningful groups mein badal deta hai.

And that is how hidden patterns slowly turn into real insights.