CSC420 ยท 2079 ยท 5 marks
What are two categories of hierarchical clustering? Divide the following data points into two clusters using agglomerative clustering. { (2,10), (2,5), (8,4), (5,8), (7,5), (6,4) }
What are two categories of hierarchical clustering? Divide the following data points into two clusters using agglomerative clustering. { (2,10), (2,5), (8,4), (5,8), (7,5), (6,4) } [5]
Hierarchical Clustering: Two Categories and Agglomerative Example
Given
Data points to cluster:
- P1 = (2, 10)
- P2 = (2, 5)
- P3 = (8, 4)
- P4 = (5, 8)
- P5 = (7, 5)
- P6 = (6, 4)
Target: 2 clusters. Linkage method not specified; I will use single linkage (minimum distance) as is standard for this textbook problem.
Solution
Two Categories of Hierarchical Clustering
-
Agglomerative (Bottom-Up): Each object starts as its own cluster. At each step the two closest clusters are merged, continuing until all objects form one cluster (or the desired number is reached).
-
Divisive (Top-Down): All objects start in a single cluster, which is repeatedly split into smaller clusters until each object is alone (or the desired number is reached).
Distance Formula (Euclidean)
$$d(P_i, P_j) = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$$
Initial Distance Matrix
| P1 | P2 | P3 | P4 | P5 | P6 | |
|---|---|---|---|---|---|---|
| P1 | 0 | 5.00 | 9.22 | 5.39 | 9.06 | 9.22 |
| P2 | 5.00 | 0 | 6.08 | 4.24 | 5.00 | 4.12 |
| P3 | 9.22 | 6.08 | 0 | 5.83 | 2.24 | 2.00 |
| P4 | 5.39 | 4.24 | 5.83 | 0 | 3.61 | 5.00 |
| P5 | 9.06 | 5.00 | 2.24 | 3.61 | 0 | 1.41 |
| P6 | 9.22 | 4.12 | 2.00 | 5.00 | 1.41 | 0 |
Sample checks:
- $d(P5,P6)=\sqrt{1^2+1^2}=1.41$ (minimum)
- $d(P3,P6)=\sqrt{2^2+0^2}=2.00$
- $d(P3,P5)=\sqrt{1^2+1^2}=2.24$
Step A: Merge closest pair
Minimum = 1.41 (P5, P6). Merge โ C1 = {P5, P6}
Clusters: {P1}, {P2}, {P3}, {P4}, {P5,P6}
Step B: Recompute (single linkage)
- $d({P5,P6},P1)=\min(9.06,9.22)=9.06$
- $d({P5,P6},P2)=\min(5.00,4.12)=4.12$
- $d({P5,P6},P3)=\min(2.24,2.00)=2.00$ โ minimum overall
- $d({P5,P6},P4)=\min(3.61,5.00)=3.61$
Merge P3 โ C1 = {P3, P5, P6}
Clusters: {P1}, {P2}, {P4}, {P3,P5,P6}
Step C: Recompute
- $d({P3,P5,P6},P1)=\min(9.22,9.06,9.22)=9.06$
- $d({P3,P5,P6},P2)=\min(6.08,5.00,4.12)=4.12$
- $d({P3,P5,P6},P4)=\min(5.83,3.61,5.00)=3.61$ โ minimum overall
(Others: $d(P1,P2)=5.00,\ d(P1,P4)=5.39,\ d(P2,P4)=4.24$)
Merge P4 โ C1 = {P3, P4, P5, P6}
Clusters: {P1}, {P2}, {P3,P4,P5,P6}
Step D: Recompute
- $d({P3,P4,P5,P6},P1)=\min(9.22,5.39,9.06,9.22)=5.39$
- $d({P3,P4,P5,P6},P2)=\min(6.08,4.24,5.00,4.12)=4.12$
- $d(P1,P2)=5.00$
Minimum = 4.12 (between big cluster and P2). Merge P2 โ C1 = {P2, P3, P4, P5, P6}
Clusters: {P1}, {P2,P3,P4,P5,P6}
Final Result (2 clusters)
We stop when exactly two clusters remain:
$$\boxed{\text{Cluster 1} = {P1} = {(2,10)}}$$ $$\boxed{\text{Cluster 2} = {P2,P3,P4,P5,P6} = {(2,5),(8,4),(5,8),(7,5),(6,4)}}$$
Point P1 = (2,10) is the outlier that separates last, forming its own cluster; all other points group together.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.