Skip to content
StackDecode
AI & ML Atlas
Machine LearningalgorithmInteractive simulation

Hierarchical Clustering

Builds a tree of clusters by repeatedly merging the two closest ones.

The idea

Start with every point in its own cluster and merge the closest pair again and again, recording each merge. The record is a dendrogram; cutting it at a chosen height gives any number of clusters. The meaning of "closest clusters" is the linkage: single, complete, average or Ward.

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

  • cluster 1
  • cluster 2
  • cluster 3

Start with every point as its own cluster (48 of them).

1/21

Agglomerative clustering repeatedly merges the nearest pair.

Step by step

  1. 1Treat each point as a cluster.
  2. 2Find the two closest clusters under the chosen linkage.
  3. 3Merge them and record the distance.
  4. 4Repeat until one cluster remains.
  5. 5Cut the dendrogram at the level you want.

Where it is used

Gene expression, document taxonomies, exploring structure without choosing k first.

Watch out for

Quadratic memory and time; merges can never be undone.

Related