Agglomerative Clustering Algorithm
What You'll Learn
You'll understand how agglomerative clustering builds clusters from the bottom up, one merge at a time.
The Bottom-Up Approach
Agglomerative clustering is the practical implementation of hierarchical clustering. It starts by treating each data point as its own cluster, then repeatedly merges the two nearest clusters until only one giant cluster remains.
Think of it like organizing a tournament bracket in reverse: you start with many individual players, pair up the closest competitors, then group those pairs, and continue until everyone's in one big group. At each step, you're recording the merge in your dendrogram.
Step-by-Step Process
- Initialize: Begin with N clusters (one per data point)
- Find nearest pair: Calculate distances between all cluster pairs using your chosen linkage criterion (single, complete, average, or Ward's)
- Merge: Combine the two closest clusters into one
- Update: Recalculate distances from the new cluster to all remaining clusters
- Repeat: Go back to step 2 until only one cluster remains
The entire process creates a hierarchy that you can "cut" at any level to get your desired number of clusters.
Why It Matters
Unlike K-Means, you don't need to specify the number of clusters beforehand. The dendrogram shows you the complete merge history, letting you choose the optimal cut point afterward. This flexibility, combined with your choice of distance metric and linkage criterion from previous lessons, makes agglomerative clustering highly adaptable.
Key Takeaway: Agglomerative clustering builds a hierarchy by starting with individual points and iteratively merging the nearest clusters, creating a complete merge tree you can cut at any height.