2.5.5 · D1Unsupervised Learning

Foundations — Dendrograms and linkage methods

1,900 words9 min readBack to topic

Before you can read the parent note, you must be able to read every squiggle it writes. Below is every symbol and idea it uses, built from the ground up. Nothing is assumed. If the parent leaned on it, we build it here first.


0. A point, and where it lives

We will keep every example in 2D so you can see it. Our running pair of clusters — the ones the parent uses for single, complete, and average linkage — are:

  • — two dots near the bottom-left corner
  • — two dots up in the top-right

Look at the picture: four chalk dots. Two are huddled near the origin (that's cluster , pale yellow), two are huddled far away (that's cluster , chalk blue). This one image is the stage for the min/max/sum linkage examples. (Ward's linkage in §6 needs a different, clearly-announced pair — watch for it.)

Recall

What does the pair mean as a picture? ::: A dot 6 units to the right and 6 units up from the origin.


1. Distance between two points —

The parent writes everywhere. It means: how far apart are two dots? We measure it with a ruler laid straight between them — the Euclidean distance.

Why the square root of squares? Because of the right triangle. Walk right by , then up by : those are the two legs of a right triangle whose hypotenuse is the direct path. Pythagoras says (leg)² + (leg)² = (hypotenuse)², so the straight distance is the square root of the two squared legs.

Recall

Why square each coordinate difference before adding? ::: To kill the sign (so counts the same as ) and to make Pythagoras hold, giving a true straight-line length.


2. What a symbol like , , and mean

Sizes of the clusters that appear on this page:

  • Running has .
  • Running has .
  • The Ward example's cluster (introduced later in §6) has .

Why the topic needs this: Average and Ward's linkage divide by counts like . If you don't know just means "how many dots in ," those formulas are unreadable.


3. The symbol — " is a point sitting inside bag "

The parent writes things like . In plain words: look at every dot taken from bag , paired with every dot taken from bag . With the running clusters and there are such pairs — exactly the four distances the parent lists.

The picture shows all four pairing-lines drawn between the two clusters. Every linkage method is just a different way of choosing which of these lines to report.


4. and — pick the smallest / biggest

Why the topic needs them:

  • Single linkage = of the four lines → the closest pair. Picture: the shortest of the four chalk lines in figure s03.
  • Complete linkage = of the four lines → the farthest pair.
Recall

Single linkage uses ; which pair of dots does that correspond to in the picture? ::: The closest dot in to the closest dot in — the shortest connecting line.


5. — add up a whole list

Two stacked 's just mean a double loop: outer loop over , inner loop over .

Why the topic needs it: Average linkage is the sum of all lines, shared out evenly. Without you can't state "consider every relationship at once."


6. The centroid and the length bars

Ward's linkage introduces two new symbols. Both have clean pictures.


7. Reading the tree: axes of a dendrogram

Cutting the tree with a horizontal line at height chops the tree into pieces: the number of vertical lines the cut crosses is the number of clusters you keep. Cut low → many tiny clusters; cut high → few big clusters.


Prerequisite map

Each node below matches a heading above: "cluster A and size bars" is §2, "all pairs a in A b in B" is §3, and so on.

point x y (section 0)

distance d a b (section 1)

all pairs a in A b in B (section 3)

cluster A and size bars A (section 2)

min gives single linkage (section 4)

max gives complete linkage (section 4)

sum gives average linkage (section 5)

centroid mu (section 6)

squared length (section 6)

Ward linkage (section 6)

dendrogram tree (section 7)

Read it as: points give distances; distances over all pairs feed the min/max/sum rules; sizes and centroids feed Ward; and all four rules feed the merge heights of the dendrogram.

For the Hinglish version of the parent walkthrough, see 2.5.05 Dendrograms and linkage methods (Hinglish).


Equipment checklist

Cover the right side and answer each before revealing.

Given and , what is ?
.
What does count?
The number of points inside cluster .
Read in plain words.
" is one of the points sitting inside cluster ."
How many pairs are there between and ?
pairs.
Which linkage uses over all pairs?
Single linkage (nearest neighbour).
Which linkage uses over all pairs?
Complete linkage (farthest neighbour).
What does tell you to do?
Add up the -coordinate of every point in .
What is the centroid of ?
— average the 's and the 's.
What does measure?
The squared straight-line gap between the two clusters' balance points.
What does the height of a bar in a dendrogram mean?
The distance (per the chosen linkage) at which those two clusters merged.
If a horizontal cut crosses 3 vertical lines, how many clusters remain?
3.