Part 16: Hierarchical Clustering: How Data Forms a Tree of Groups
A beginner-friendly guide to Hierarchical Clustering, explaining how groups are formed and visualized using Dendrograms.

Imagine you're organizing a family reunion.
At first, everyone is together in one big group. Then you notice that some people are siblings, some are cousins, and some belong to different branches of the family.
You can keep dividing the big group into smaller groups until you reach individual people.
Or, you can start with each person separately and gradually bring people who are closely related together.
This is the basic idea behind Hierarchical Clustering.
Instead of simply creating groups, Hierarchical Clustering builds a hierarchy of groups, showing how smaller groups combine into larger ones or how larger groups split into smaller ones.
Let's understand how it works with a simple example.
🤔What is Hierarchical Clustering?
Hierarchical Clustering is an Unsupervised Machine Learning algorithm used to group similar data points together.
The interesting part is that it doesn't just give us the final clusters. It also shows how those clusters were formed step by step.
Think about organizing books in a library.
You might first group books by similar topics:
Science → Physics → Quantum Physics
or
Arts → History → Ancient History
This creates a hierarchy, where smaller groups belong to larger groups.
Hierarchical Clustering does something similar with data.
🌳How Does Hierarchical Clustering Work?
There are two main approaches:
Agglomerative Clustering
Divisive Clustering
⬆️Agglomerative Clustering: Bottom-Up Approach
Agglomerative Clustering starts with each data point as its own individual cluster.
Then, the algorithm gradually combines the most similar clusters together.
That's why it is called a bottom-up approach.
👥Real-Life Example
Imagine five students standing separately in a classroom.
At first:
Student A | Student B | Student C | Student D | Student E
The teacher notices that A and B have similar interests, so they form a group.
Then C and D are found to be similar, so they form another group.
Now we have:
(A, B) | (C, D) | E
The algorithm continues combining similar groups until eventually everyone belongs to one large group.
The process looks like:
Individual points → Small groups → Larger groups → One big group
This is the most commonly used type of Hierarchical Clustering.
⬇️Divisive Clustering: Top-Down Approach
Divisive Clustering works in the opposite direction.
It starts with all data points in one large cluster and gradually divides them into smaller groups.
That's why it is called a top-down approach.
🏫Real-Life Example
Imagine a school with all students together.
The school first divides them into:
Science students | Commerce students | Arts students
Then each group can be divided further.
For example:
Science → Physics | Biology | Chemistry
The process continues until the groups become smaller and more specific.
So the process looks like:
One big group → Smaller groups → Even smaller groups → Individual points
🌿What is a Dendrogram?
A dendrogram is a tree-like diagram that shows how clusters are formed or separated.
Think about a family tree.
At the top, you might have grandparents. Their children form separate branches, and those branches continue into grandchildren.
A dendrogram works in a similar way.
It shows which data points are grouped together and at what distance they were combined.
🧩Understanding a Dendrogram with an Example
Suppose we have five customers:
A, B, C, D, E
Initially, every customer is separate.
The algorithm might discover that:
A and B are very similar → they join first.
D and E are also similar → they join next.
C is somewhat similar to D and E → it joins their group.
Finally, the two larger groups are combined.
📏What Does Height Mean?
The height represents the distance or dissimilarity between the groups being joined.
Short branch → Groups are more similar.
Tall branch → Groups are more different.
So, if A and B are joined at a very low height, it means they are highly similar.
If two groups are joined much higher up, they are less similar.
✂️How Do We Get the Final Clusters?
One useful thing about a dendrogram is that we can cut it at a certain height to decide how many clusters we want.
Imagine drawing a horizontal line across the dendrogram.
Depending on where you cut it, you can get:
2 clusters
3 clusters
4 clusters
and so on.
This is different from K-Means, where we usually choose K before running the algorithm.
With Hierarchical Clustering, the dendrogram gives us a visual way to explore different possible numbers of clusters.
🧰Where is Hierarchical Clustering Used?
Hierarchical Clustering can be useful in many real-world situations.
Customer Segmentation: Businesses can group customers based on shopping habits, spending, or preferences.
Biology: Researchers can group genes or biological samples based on similarities.
Document Grouping: Similar documents, articles, or news stories can be grouped together based on their content.
Product Recommendation: Products with similar characteristics or purchasing patterns can be grouped to improve recommendations.
🎯Final Thoughts
Hierarchical Clustering helps us group similar data step by step and understand how different groups are connected. With dendrograms, we can easily visualize these relationships and choose the clusters that make the most sense.
🚀Coming Up Next
In the next blog, we'll explore Principal Component Analysis (PCA) and understand how it reduces complex data into simpler forms while keeping the most important information.
Comments
Join the discussionNo comments yet. Be the first to comment.
AI, ML & Deep Learning: A Beginner’s Journey
A step-by-step journey through AI, Machine Learning, and Deep Learning, covering concepts, applications, and practical insights.






