Hierarchical Clustering: Read Dendrograms and Choose a Defensible Cut

Build an average-linkage hierarchy from five points, audit every merge, read its dendrogram correctly, and compare defensible two-cluster and three-cluster cuts.

KnowledgeGate Team

Exam prep & CS education

Updated 27 Nov 20266 min read
Hierarchical Clustering: Read Dendrograms and Choose a Defensible Cut

A library can generate a dendrogram in one call, but the picture is easy to misread. Learners often confuse leaf spacing, merge height and the number of clusters created by a cut, although they are different. For A=1, B=2, C=5, D=9 and E=11, the average-linkage run produces heights 1, 2, 3.5 and 44/6. The dendrogram supports defensible two-cluster and three-cluster cuts, depending on the analytical purpose.

1. Hierarchical clustering builds nested groups, not one fixed partition

Agglomerative hierarchical clustering is bottom-up. Start with singleton clusters {A}, {B}, {C}, {D} and {E}. Repeatedly merge the two closest current clusters until one remains. The nested merge sequence is the hierarchy; a later cut converts it into a flat partition.

K-means asks for k before fitting and represents clusters with centroids. Agglomerative clustering exposes partitions at several levels, but still needs a distance metric, linkage rule and final cut. Neither is universally better.

For this example, use A=1, B=2, C=5, D=9, E=11, Euclidean distance d(i,j)=|x_i-x_j|, and average linkage.

2. Distance and linkage answer two different questions

A distance metric compares two observations. Linkage turns all cross-cluster point distances into one cluster-to-cluster dissimilarity. For clusters P and Q:

  • Single linkage uses min d(p,q). It joins through the nearest bridge, so sparse connectors can produce chains.

  • Complete linkage uses max d(p,q). It controls the farthest cross-pair and tends towards tighter groups, but reacts to extremes.

  • Average linkage uses (1/(|P||Q|)) sum d(p,q) across all cross-pairs. It balances them, but is not the distance between cluster centroids.

Ward linkage is different: it chooses the merge with the smallest increase in within-cluster sum of squares. Its displayed heights can follow implementation-specific scaling, so do not mix them into this average-linkage arithmetic.

Feature scale is also part of distance. If age is around 20 and income around 500000, income can dominate Euclidean distance unless preprocessing is deliberate.

3. Build the starting distance table from five exact values

In one dimension, Euclidean distance is absolute difference. For example, d(B,D)=|2-9|=7 and d(C,E)=|5-11|=6. The full matrix must be symmetric, with zeroes on its diagonal:

A

B

C

D

E

A

0

1

4

8

10

B

1

0

3

7

9

C

4

3

0

4

6

D

8

7

4

0

2

E

10

9

6

2

0

The unique smallest off-diagonal value is 1, so {A} and {B} merge first at height 1. The dendrogram records it as their crossbar height. The left-to-right leaf gap is layout, not the value 1.

4. Run average linkage and audit every merge height

After merging {A,B}, update every affected distance:

  • d(AB,C)=(4+3)/2=3.5

  • d(AB,D)=(8+7)/2=7.5

  • d(AB,E)=(10+9)/2=9.5

The remaining singleton distances are d(C,D)=4, d(C,E)=6 and d(D,E)=2. The next minimum is 2, so {D,E} merges second.

Now audit the reduced table. d(AB,DE)=(8+10+7+9)/4=34/4=8.5, while d(C,DE)=(4+6)/2=5.

AB

C

DE

AB

0

3.5

8.5

C

3.5

0

5

DE

8.5

5

0

The next minimum is 3.5, so {AB} joins {C}. Finally, all six cross-distances between {A,B,C} and {D,E} give (8+10+7+9+4+6)/6=44/6=22/3, about 7.333. The full sequence is therefore AB @ 1, DE @ 2, AB+C @ 3.5, ABC+DE @ 7.333.

Average-linkage merge audit for A=1, B=2, C=5, D=9, E=11, with merges at heights 1, 2, 3.5 and 7.333 and the reduced distance table.

5. Read the dendrogram from merge bars and cut lines

Read the dendrogram from bottom to top. Leaves A to E are observations. A and B join at y-axis height 1; D and E join at 2; the AB branch joins C at 3.5; ABC joins DE at 7.333. Every horizontal merge bar sits at its linkage dissimilarity. Leaf order may flip within a branch without changing the hierarchy, so x-axis proximity alone proves nothing about raw distance.

A horizontal cut reveals the surviving branches:

  • At h=1.5: {AB}, {C}, {D}, {E}

  • At h=3: {AB}, {C}, {DE}

  • At h=4: {ABC}, {DE}

  • Above 44/6: {ABCDE}

Cutting exactly at 1, 2, 3.5 or 44/6 needs a boundary convention. A teaching cut should sit strictly between merge bars. The final height 44/6, about 7.333, is the mean of six cross-pair distances, not the nearest number-line gap |5-9|=4.

Dendrogram for A=1, B=2, C=5, D=9, E=11 with merge bars at 1, 2, 3.5 and 7.333 and cut lines drawn at h=3 and h=4.

6. Choose a cut with a gap, an objective and a validation check

The largest consecutive merge jump is 44/6-3.5=23/6, about 3.833. Since 3.5 < 4 < 44/6, the cut at h=4 preserves {A,B,C} and {D,E}. That gap suggests a separation, but cannot prove the correct real-world cluster count. If the task requires k=3, cut strictly between 2 and 3.5.

Silhouette scores audit original Euclidean distances, not dendrogram heights. In A-to-E order, exact k=2 values are 13/18, 3/4, 3/10, 13/19, 19/25; exact k=3 values are 3/4, 2/3, 0, 1/2, 2/3. Repeating values are rounded below:

Cut

Point silhouettes

Mean

{ABC}, {DE}

A=0.722, B=0.750, C=0.300, D=0.684, E=0.760

0.643

{AB}, {C}, {DE}

A=0.750, B=0.667, C=0, D=0.500, E=0.667

0.517

The means are exactly 55001/85500, about 0.643, and 31/60, about 0.517. The second row uses the teaching convention s(C)=0 for a singleton. For these values and this metric only, silhouette favours k=2.

A defensible decision order is: match the analytical purpose and domain constraints; compare candidate cuts through separation or held-out usefulness; then test stability under reasonable resampling, scaling and linkage choices. Python Programming is a broader programming route for implementing such audits.

7. Linkage choices and dendrogram traps that assessments expose

The raw matrix stays fixed, but the linkage rule changes the hierarchy:

Linkage

Merge heights

Single

1, 2, 3, 4

Complete

1, 2, 4, 10

Average

1, 2, 3.5, 7.333

The third merge differs because d_single(AB,C)=min(4,3)=3, d_complete(AB,C)=max(4,3)=4, and d_average(AB,C)=(4+3)/2=3.5. The data are unchanged, but the heights and apparent gaps are not.

Wrong move

What goes wrong

Correct move

Read x-axis spacing as distance

Leaf layout can change

Read merge-bar height

Average centroids

That is not average linkage

Average all cross-pairs

Keep old distances after a merge

The next minimum may be wrong

Update cluster distances

Cut through a merge bar silently

Membership depends on convention

Cut strictly between heights

Trust the largest-looking gap

Purpose may require another k

Validate candidate cuts

Compare unlike scales or linkages

Heights have different meanings

Compare under matched choices

Quick checks: after AB @ 1, average linkage merges DE @ 2; h=3 gives three clusters; h=4 gives two; complete linkage ends at 10 because its farthest cross-pair is A-E. For the full validation treatment, Silhouette Score vs Inertia: Compare Clustering Quality with a Worked Example owns the complete metric comparison; here silhouette only checks the two cuts obtained from this dendrogram.

8. Use the hierarchy to choose and validate a cut

Remember the chain: choose preprocessing and a point metric; choose linkage; start with singletons; merge the closest current pair; read each crossbar at its merge height; cut between heights after checking purpose and validation. Here, average linkage gives 1, 2, 3.5, 7.333, and h=4 yields {A,B,C} and {D,E}.

Now hide the reduced table. Recompute d(AB,DE)=8.5 and d(C,DE)=5, explain why AB joins C first, then predict and confirm complete linkage's final height of 10. Artificial Intelligence (AI) is the broader next learning route into AI and machine learning. For broader applied practice, browse Coding & Skill Development Courses.