Q13Machine Learning
Question
Explain Agglomerative Hierarchical Clustering with an example.
Answer
A detailed algorithmic trace of Agglomerative Hierarchical Clustering. Explains the "bottom-up" mathematical fusion of data points using distance linkages to generate a massive tree-like Dendrogram architecture.
Unlike K-Means, which forces the engineer to blindly guess the number of clusters () upfront, Hierarchical Clustering mathematically builds a massive, multi-level hierarchy of clusters. "Agglomerative" is the strictly bottom-up approach to building this architecture.
The Mathematical Algorithm
- Step 1 (Initialization): Treat every single data point in the dataset as its own absolute independent cluster. If there are points, there are strictly 500 clusters.
- Step 2 (Proximity Calculation): Mathematically calculate the Distance Matrix between all existing clusters. This is typically done using Euclidean distance.
- Step 3 (The Violent Fusion): Identify the two clusters that are mathematically the absolute closest to each other. Aggressively fuse them together into a single new cluster. The total number of clusters is now .
- Step 4 (Linkage Update): Mathematically recalculate the distances between the new fused cluster and all remaining clusters using a Linkage Criteria (e.g., Single Linkage = distance between the closest points; Complete Linkage = distance between the furthest points).
- Step 5: Repeat Steps 3 and 4 endlessly until every single data point is fused into ONE massive, singular root cluster.
The Dendrogram
The algorithm does not output a simple label. It outputs a Dendrogram—a massive mathematical tree graph. The vertical y-axis represents the absolute mathematical distance at which two clusters were fused. The engineer visually inspects the Dendrogram and draws a horizontal line across the longest vertical branches to violently "slice" the tree into the absolute mathematically optimal number of clusters.