Log inStart free
LESSON 4.31 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Hierarchical clustering

Watch 40 points merge, closest pair first, into one tree of clusters.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 4.31 · CLUSTER BAY40 POINTS · 780 DISTANCES · 40 CLUSTERS
01
Stage 1 of 6 · Every point alone
Agglomerative clustering starts with 40 clusters of 1 point. The bars count all 780 distances between pairs.
Explain it simply

Each of the 40 points starts as its own cluster. The method measures the straight-line distance between every pair of points, 780 numbers in all. It keeps them in a table called the distance matrix. The bars on the right count how many pairs sit at each distance.

Forty points, numbered 1 to 40, each in its own cluster. The bars count 780 distances, from 0.20 to 10.70.

point and distancelinkage pair, cut and gapmerge and cluster
pointsdendrogramall 780 distances00.511.522.5height123456789101112131415161718192021222324252627282930313233343536373839400246810distance →97 pairs02468100246840 points · 40 · 39 / 2 = 780 distancesclosest d(10, 11) = 0.20 · farthest d(1, 40) = 10.70every point is its own clusterpointsdendrogramall 780 distances00.511.522.5height123456789101112131415161718192021222324252627282930313233343536373839400246810distance →97 pairs02468100246840 points · 40 · 39 / 2 = 780 distancesclosest d(10, 11) = 0.20 · farthest d(1, 40) = 10.70every point is its own cluster
Toy: the 40 points of 4.C3 · Euclidean distance · 4 linkage rules
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
d(p,q)=(xp−xq)2+(yp−yq)2d(\sy{p}{data}{p},\sy{q}{data}{q}) = \sqrt{(\sy{x}{data}{x_p} - \sy{x}{data}{x_q})^2 + (\sy{y}{data}{y_p} - \sy{y}{data}{y_q})^2}
d(10, 11)=(2.3−2.3)2+(4.2−4.4)2=0.20d(10,\ 11) = \sqrt{(2.3 - 2.3)^2 + (4.2 - 4.4)^2} = 0.20

The distance is the straight-line length between two points.

Common mix-ups

MYTHSingle linkage always finds compact, round clusters.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01At k = 3, does complete linkage keep the ring in one cluster?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.