The working of the AHC algorithm can be explained using the below steps:
-
Step-1: Create each data point as a single cluster. Let’s say there are N data points, so the number of clusters will also be N.
-
Step-2: Take two closest data points or clusters and merge them to form one cluster. So, there will now be N-1 clusters.
-
Step-3 : Again, take the two closest clusters and merge them together to form one cluster. There will be N-2 clusters.
-
Step-4: Repeat Step 3 until only one cluster left. So, we will get the following clusters. Consider the below images:
- Step-5: Once all the clusters are combined into one big cluster, develop the dendrogram to divide the clusters as per the problem.