Concepts / Dendrograms and Reading Cluster Trees

Dendrograms and Reading Cluster Trees

Agglomerative clustering moves from many small clusters, one per point, toward one final grouping. The points themselves never change. Only the grouping changes.

  • Programming

One Grouping Is Not the Whole Story

Most introductions to clustering ask you to pick one grouping of your data. Hierarchical clustering asks a different question: what happens if we watch the grouping form, one step at a time, and keep every stage of that process? Instead of producing a single answer, it produces a family of answers. Each one is a valid grouping of the same points, but each has a different number of clusters.

What do you think happens?

You have five points and run agglomerative clustering. Before any merging has happened, how many clusters are there?

  • 1

  • 3

  • 5

  • It depends on the distances between the points

Reveal answer
Answer:

5

Agglomerative clustering begins with every data point as its own one-point cluster. So at the start, the number of clusters equals the number of points.

How Agglomerative Clustering Starts

Agglomerative clustering is the method that produces a hierarchical clustering. Its defining feature is the direction of its journey. It does not start from a few large groups and split them apart. It starts from the other end: every data point begins as its own one-point cluster.

The source describes the whole procedure as iterative. Each point makes a journey from being a single-point cluster to belonging to some final cluster. Notice what this says about the start and the end. At the start, the number of clusters equals the number of points. At the end, every point belongs to one of the final clusters. Everything in between is the process of points being gathered together.

Key point

Agglomerative clustering moves from many small clusters, one per point, toward one final grouping. The points themselves never change. Only the grouping changes.

Watching the Clusters Merge

Each intermediate step of the process is itself a clustering of the data. The steps differ only in how many clusters they contain. Early steps have many small clusters, and later steps have fewer and larger ones. Because every stage is a complete clustering, you do not have to commit to one stage in advance. You can look at the whole sequence and decide which level of grouping is useful for your purpose.

Stage 0five single-point clustersStage 1points 1 and 2 mergedStage 2point 3 joins 1 and 2Stage 3points 4 and 5 pairedStage 4one final clustermergemergemergemerge
After each merge, the set of clusters is replaced by a new set with one fewer cluster. The learner question: what happens to the set of clusters at each merge, and how does the process move from single points to one final grouping?

Tracing Five Points Through Each Stage

A concrete trace makes the iterative idea easier to see. Take five points, numbered 1 to 5. The source's teaching example follows the same pattern: points 1 and 2 join first, point 3 later joins them, and points 4 and 5 form their own pair. Follow how the number of clusters drops with each stage, and notice that every point is present in every stage.

Worked example

Five points through successive clusterings

Points 1 to 5 start as single-point clusters. Trace the clustering stage by stage and record how many clusters remain after each stage.

  1. 1
    Stage 0, the start

    Each point is its own cluster: {1}, {2}, {3}, {4}, {5}. That is 5 clusters, one per point.

  2. 2
    Stage 1, first merge

    Points 1 and 2 join: {1,2}, {3}, {4}, {5}. The number of clusters drops from 5 to 4.

  3. 3
    Stage 2, second merge

    Point 3 joins the group: {1,2,3}, {4}, {5}. The number of clusters drops from 4 to 3.

  4. 4
    Stage 3, third merge

    Points 4 and 5 form their own pair: {1,2,3}, {4,5}. The number of clusters drops from 3 to 2.

  5. 5
    Stage 4, final merge

    The two remaining clusters combine into one: {1,2,3,4,5}. The number of clusters is now 1, and every point belongs to this final cluster.

Result

The cluster count falls 5, 4, 3, 2, 1 across the five stages. Each stage is a complete clustering of the same five points, and no point is dropped or duplicated.

Stage 05 clusters: each pointaloneStage 14 clusters: 1 and 2togetherStage 23 clusters: 1, 2 and 3togetherStage 32 clusters: 4 and 5togetherStage 41 cluster: all five pointsnextnextnextnext
The same trace as the worked example, shown as a sequence. After each merge, one fewer cluster remains, and the group membership shown in each sublabel is the only thing that changes. The learner question: after each merge, how many clusters remain, and which points are now grouped together?

Reading the Cluster Tree

The stages are linked. The clusters at one level are built from the clusters at the level before, and a cluster that appears in a later stage is made from clusters that existed earlier. This linking is what makes the result a hierarchy rather than a list of unrelated groupings.

A tree diagram shows that structure. The bottom row holds the individual points, and each line of merging moves upward until everything sits in one final cluster. Read the diagram from the bottom up. Points 1 and 2 join first, point 3 later joins them, and points 4 and 5 form their own pair. The top node is the stage where everything has merged. This diagram is a small teaching illustration. It follows the same pattern the source describes, in which every stage in between is a valid clustering.

Point 1Cluster 1 and 2first mergeCluster 1, 2 and 3point 3 joinsAll five pointsfinal clusterPoint 2Cluster 4 and 5pair formedPoint 3Point 4Point 5
Read from the bottom up. Each upward line marks a merge, and every node is a cluster that exists at some stage. The learner question: how do the clusters at every step nest inside one another, and which larger cluster does each smaller cluster belong to?

Overlaying Every Clustering at Once

Because each stage is a valid clustering, it is sometimes useful to look at all of them on one picture. The source does this with an overlay: it draws every clustering from the run together. The lines in the picture show the cluster assignments, and the data points are numbered so you can follow any one point through the stages. The overlay shows how each cluster breaks up into smaller clusters, which is exactly what a hierarchy is meant to reveal.

The source produces this picture with a helper plotting function from the mglearn package, which the course text uses for its illustrations. That call is a plotting call, not a clustering call on your own data. Treat it as a way to view the structure, not as the algorithm itself.

When you read an overlay, ask which lines stay together as you move from one stage to the next. A group of points that stays linked across several stages is a stable part of the structure. A group that splits apart quickly was gathered only at a fine level of detail.

Mistakes When Reading a Cluster Tree

  • Common mistake

    Treating the tree as one answer that the algorithm has already chosen

    What it looks like

    Looking at the top of the tree and concluding that five points are truly one group.

    Why it fails

    The top node is only the final stage. Every stage below it is also a valid clustering, and the overlay does not say which stage is correct.

    Do this instead

    Look across the stages and decide which level of grouping suits your purpose.

  • Common mistake

    Assuming a group that splits quickly is meaningless

    What it looks like

    Seeing a cluster break apart in the next stage and dismissing it.

    Why it fails

    A group that splits apart quickly was gathered only at a fine level of detail. That is information, not an error.

    Do this instead

    Note at which stage the group splits, and ask whether that level of detail matters for your question.

  • Common mistake

    Reading the points themselves as changing between stages

    What it looks like

    Believing point 3 moves or disappears when it joins points 1 and 2.

    Why it fails

    The points never change. Only the grouping changes, and no point is dropped or duplicated.

    Do this instead

    Follow each numbered point through the stages and watch only its group membership.

  • Common mistake

    Forgetting that the number of clusters drops at every merge, so a stage with many clusters is an early stage, not a final result

Feature of the treeWhat it tells youCaution
Which points join a clusterMembership at the stage where the merge happensMembership is what the stages define, so read it stage by stage
How many clusters exist at a stageThe count drops by one at each mergeThe count alone does not say which grouping is correct
A group that stays linked across stagesA stable part of the structureStability is judged across stages, not in a single one
A group that splits apart quicklyIt was gathered only at a fine level of detailDo not dismiss it as meaningless
The overall picture of nestingEach smaller cluster belongs to a larger oneThe source's point is the nesting, so read nesting, not single snapshots

Features of a cluster tree and what each one means

Practice Tracing Your Own Stages

EASY

Four points, numbered 1 to 4, are clustered agglomeratively. Stage 1 merges points 1 and 2. Stage 2 merges points 3 and 4. Stage 3 merges the two pairs into one cluster. Write the cluster count at each stage, starting from the beginning, and state which points form each cluster after Stage 2.

Hints
  • At the start, every point is its own cluster, so the count equals the number of points.
  • Each merge combines two clusters into one, so the count drops by one per merge.
  • After Stage 2 there are two pairs: one pair from Stage 1 and one from Stage 2.

Key Takeaways

  • Agglomerative clustering starts with every point as its own one-point cluster and merges clusters step by step until one final grouping remains.
  • Each stage is a complete clustering of the same points, and the number of clusters drops with each merge.
  • Later clusters are built from earlier ones, so the stages form a hierarchy that can be read as a tree from the bottom up.
  • An overlay of all stages shows how each cluster breaks into smaller clusters, but it does not by itself say which stage is correct.
  • Watch which groups stay linked across stages, and avoid reading the top node as the only valid answer.

Related concepts

More concepts starting with D