Hierarchical agglomerative clustering:
The hierarchical agglomerative clustering uses the bottom-up approaches. In the HAC algorithm
starts with every single data point as a single cluster. The similar clusters are successively merged
until all clusters have merged into a one cluster and result is represents in tree structure as named
dendogram.
Let’s understanding with example:
Sample Data:
Formulas:
Calculation Steps:
Step 1: Draw the graph.
Step 2: Calculate Euclidean distance, create the distance matrix.
Same formula can be used for (p1,p3),(p1,p4),(p1,p5),(p1,p6)
Same formula can be used for (p2,p4),(p2,p5),(p2,p6)
Same formula can be used for (p3,p5),(p3,p6)
Same formula can be used for (p4,p6)
The distance matrix is:
Step 3: Find the minimum value element from distance matrix.
The minimum value element is (p3,p6)and value is 0.11
i.e. our 1st cluster (p3,p6)
Step 4: Recalculate or update the distance matrix for cluster(p3,p6)
Same formula can be used for p2,p4,p5
Updated distance matrix:
Step 5: repeat the step 3 & 4.
The minimum value element is (p2,p5)and value is 0.14
i.e. our 2nd cluster (p2,p5)
Recalculate or update the distance matrix for cluster (p2,p5)
Same formula can be used for (p3,p6),p4
Updated distance matrix:
Step 6: repeat the step 3 & 4.
The minimum value element is (p2,p5,p3,p6) and value is 0.15
Here 2 values are same then first element is choose as minimum value element
i.e. our 3rd cluster (p2,p5,p3,p6)
Recalculate or update the distance matrix for cluster (p2,p5,p3,p6)
Same formula can be used for p4
Updated distance matrix:
Step 7: repeat the step 3 & 4.
The minimum value element is (p2,p5,p3,p6,p4) and value is 0.15
i.e. our 4th cluster (p2,p5,p3,p6,p4)
Recalculate or update the distance matrix for cluster (p2,p5,p3,p6,p4)
Updated distance matrix:
Step 8: repeat the step 3 & 4.
The minimum value element is (p2,p5,p3,p6,p4,p1) and value is 0.22
i.e. our 5th cluster (p2,p5,p3,p6,p4,p1)
Recalculate or update the distance matrix for cluster (p2,p5,p3,p6,p4,p1)
In this step only 1 value is remaining so it is by default cluster.
Step 9: Drawing the Dendogram.