Introduction:
Hierarchical clustering, also known as hierarchical cluster analysis or HCA, is another unsupervised machine learning approach used to sort unlabeled datasets into clusters.
The dendrogram is a tree-shaped structure that we construct in this approach to develop the hierarchy of clusters.
The results of K-means clustering and hierarchical clustering may appear similar at times, however, they differ depending on how they work. Because there is no need to predetermine the number of clusters as in the K-Means technique.
Source: https://www.google.com/url?sa=i&url=https%3A%2F%2Fbi-kring.nl%2F29-business-intelligence%2F1153-using-hierarchical-clustering-in-data-analysis&psig=AOvVaw3BBTgzI7CkaOwFduR1MzX9&ust=1654066698810000&source=images&cd=vfe&ved=0CAwQjRxqFwoTCLir5-WUifgCFQAAAAAdAAAAABAZ
The goal of Hierarchical Clustering is to create a hierarchical succession of nested clusters. This hierarchy is graphically represented by a Dendrogram, which is an inverted tree that describes the sequence in which factors are integrated (bottom-up perspective) or clusters are broken up (top-down view).
There are two ways to hierarchical clustering:
Agglomerative is a bottom-up technique in which the algorithm starts with all data points as single clusters and merges them until only one cluster remains.
Divisive: The divitive algorithm, which is a top-down technique, is the inverse of the agglomerative algorithm.
Source: https://www.saedsayad.com/images/Clustering_h1.png
Why we need Hierarchical Clustering:
There are certain issues with K-means clustering, such as a predefined number of clusters, and it always tries to form clusters of the same size. To address these two issues, we can use the hierarchical clustering algorithm, which does not require knowledge of a pre-set number of groups.
Agglomerative Hierarchical Clustering:
It is a bottom-up approach. Consider each data point as an independent Cluster and combine the cluster’s nearest couples at each stage. At initially, each data set is regarded as a separate entity or cluster. At each cycle, the clusters merge with other clusters until only one cluster remains.
Source: https://media.geeksforgeeks.org/wp-content/uploads/20200204181551/Untitled-Diagram71.png
The Agglomerative Hierarchical Clustering Algorithm is:
1. Calculate the resemblance of one cluster to all of the others (calculate proximity matrix)
2. Consider each data point to be a separate cluster.
3. Combine clusters that are substantially similar or close in size.
4. For each cluster, recalculate the proximity matrix.
5. Steps 3 and 4 should be repeated until only one cluster remains.
Divisive Hierarchical Clustering:
It is the inverse of Agglomerative Hierarchical clustering and takes a top-down method. We consider all of the data points as a single cluster in Divisive Hierarchical clustering, and in each iteration, we separate the data points from the clusters that aren’t similar. Finally, we are left with N clusters.
Source: https://media.geeksforgeeks.org/wp-content/uploads/20200204181916/Untitled-Diagram-153-1.png
Applications of Hierarchical Clustering:
1. Charting Evolution through Phylogenetic Trees
2. Tracking Viruses through Phylogenetic Trees
3. US Senator Clustering through Twitter