Dendrograms and Tree Representations
What you'll learn: How to read dendrograms to understand how clusters form step-by-step and decide the optimal number of clusters for your data.
What Is a Dendrogram?
A dendrogram is a tree-like diagram that shows how hierarchical clustering merges data points or clusters at each step. Think of it like a family tree, but instead of showing ancestry, it shows which observations or clusters "marry" together as we move from many small clusters to fewer large ones.
The vertical axis represents the distance (or dissimilarity) at which clusters merge. The horizontal axis shows individual data points or clusters. Each upside-down U-shape (called a "merge") tells you when two clusters joined together.
Reading a Dendrogram
Start at the bottom: each leaf represents one data point. As you move upward, branches merge. The height of each merge indicates how different the joining clusters are—tall merges mean the clusters being combined are quite dissimilar.
Finding the Optimal Number of Clusters
To determine how many clusters fit your data, imagine drawing a horizontal line across the dendrogram. This "cuts" the tree. The number of vertical lines your cut crosses equals the number of clusters you'll get.
Where should you cut? Look for the longest vertical distance without any merges—this suggests natural separation. Cutting there captures distinct groups before forcing dissimilar clusters together.
Practical Insight
If you cut low (near the bottom), you get many small clusters. Cut high (near the top), and you get few large clusters. The "sweet spot" is where there's a big vertical gap, indicating a natural stopping point before very different groups merge.
Key Takeaway: Dendrograms visualize the hierarchical clustering process as a tree, letting you identify optimal cluster numbers by cutting where vertical distances between merges are largest.