AI Glossary / AI and machine learning / Intermediate
Hierarchical clustering
Definition
Hierarchical clustering is clustering that builds a tree of groupings, from every item in its own cluster up to everything in one cluster, so you can cut the tree at the level that gives the number of groups you need.
What it means
Instead of asking for a fixed number of clusters up front, hierarchical clustering builds the whole family tree: which two items are most alike, which groups merge next, all the way up. The result is one structure containing every possible granularity.
The tree, drawn as a dendrogram, is itself the deliverable. You can see that these two products are near-twins, that this pair of regions forms a natural bloc, and that one odd customer joins any group only at the last merge.
Cutting the tree at a chosen height yields the flat clusters for operations, and the choice can be revisited without re-running anything: raise or lower the cut and a different granularity falls out of the same structure.
The price is scale. Building the full tree compares everything with everything, so the method suits thousands of items, not millions; large datasets need sampling or a different method.
For a business, hierarchical clustering shines in exploratory work: understanding the shape of a customer file, a product range or a document library before deciding how many groups the operation actually wants.
How it works
Choose the similarity measure and the linkage rule, which decides how distance between groups is defined: closest pair, furthest pair or average.
Start with every item as its own cluster and repeatedly merge the two most similar clusters, recording each merge.
Draw the dendrogram and read it: merge heights show how similar each joined pair was, and big jumps suggest natural group counts.
Cut the tree at a chosen height to get flat clusters, and profile them in business terms before acting on them.
Validate the chosen cut for stability: re-run on samples and check that the same groupings keep appearing.
Three practical examples
- A merchandising team dendrogramming 800 products to see which ranges genuinely cohere before restructuring the catalog.
- An analyst clustering 3,000 customers and cutting the tree at three levels: 4 segments for the board, 12 for campaign planning, 40 for testing.
- A compliance team clustering vendors and spotting one supplier that joins any group last, prompting a closer look at an outlier.
Think of it this way
Think of a family reunion chart. At the top everyone is one family; lower down the chart splits into branches, then households, then individuals. Where you draw the line across the chart decides whether you are mailing branches or households, and the chart itself does not change. The dendrogram is that chart.
The limit: the chart shows closeness, not meaning. Two branches joined early are similar by your chosen measure, and whether that similarity matters for the decision at hand is a judgment the tree cannot make for you.
Worked example
one tree, three audiences
Suppose a grocer clusters 5,000 store-product combinations once, and three teams use the same tree. The figures are illustrative.
The executive team takes the 5-group cut for reporting, the pricing team takes the 22-group cut for elasticity work, and the supply team reads the dendrogram itself to find products that behave like lone wolves.
None of the three exercises required a re-run; each cut was a new line across an existing chart.
When a re-cluster is eventually needed, a stability check shows the top of the tree unchanged, so only the fine branches are refreshed.
Illustrative case study
A fictional consultancy delivered a flat eight-cluster segmentation, and the client's marketing team spent a year fighting for a ninth and tenth group the data clearly contained.
A hierarchical re-analysis later showed the tree had those groups all along; the flat answer had simply hidden them behind an arbitrary early choice.
The invented lesson: asking for k groups before looking at the tree is ordering the answer before reading the question. Build the hierarchy, then choose.
Common misconceptions and mistakes
- It gives you the right number of clusters. It gives you every number of clusters; choosing where to cut remains a human decision informed by the tree's shape.
- It is just slow k-means. The output is different in kind: a full merge tree rather than a single partition, usable at many granularities.
- The dendrogram is only for statisticians. It is one of the most readable outputs in analytics: a picture of what resembles what, legible to any careful reader.
Business use
Use hierarchical clustering for exploration on datasets up to a few thousand items; sample down from larger files.
Present the dendrogram to stakeholders before presenting any flat segmentation; it settles many arguments about group counts.
Keep the tree when you publish the cut: future granularity questions answer themselves from the stored structure.
People also ask
What is a dendrogram?
The tree diagram of merges: vertical height shows how different the merged groups were, and cutting across it at a height yields flat clusters.
What is a linkage rule?
The rule defining distance between groups, such as nearest member, furthest member or average, and it changes the tree's shape.
When should I not use it?
On very large datasets, where all-pairs comparison is too expensive; sample first or use a scalable method instead.
Check your understanding
Why does one hierarchical clustering run support several different cluster counts?
Answer: Because the run builds the full merge tree, and each flat segmentation is just a cut across that tree at a different height, with no re-fitting required.
Related terms
- Hard clustering
- k-means
- Segmentation
- Similarity
- dendrogram
- linkage
Learn next
AI for Business Owners explains how to read a segmentation's structure before committing a budget to it: https://aiforbusinessandlife.com/academy/ai-for-business-owners. [C2]
More in AI and machine learning
- Hidden Markov random field - A Hidden Markov random field is a model for data arranged in a grid or network, most often images, where hidden labels at each location depend on their...
- Hidden Markov Segment Model - A Hidden Markov Segment Model is a sequence model that treats observations as arriving in variable-length segments, each generated as a unit by one hidden...
- Hierarchical Classification - Hierarchical Classification is classification into a taxonomy of categories that sit inside one another, where a prediction can name a broad class, a...
- Hierarchical control system - A hierarchical control system organizes control responsibilities into levels, with higher levels setting broader goals and lower levels handling more...
- Hierarchical navigable small world - Hierarchical navigable small world, usually abbreviated HNSW, is a graph-based method for approximate nearest-neighbor search.
- Highway network - A highway network is a neural-network architecture that uses learned gates to control how information is transformed or carried through layers.
Sources
[S2] Google, Machine Learning Glossary; [S14] KNIME, Data Science Glossary; [S22] Berkeley BOP, Artificial Intelligence Ontology (aio.owl); [S24] scikit-learn documentation, Glossary of Common Terms and API Elements. Full URLs are in the source ledger. Verified 11 October 2026.
Previous: Hierarchical Classification Next: Hierarchical control system