Exp 8
Exp 8
08
Introduction
Hierarchical clustering is an unsupervised learning method for clustering data points. The
algorithm builds clusters by measuring the dissimilarities between data. Unsupervised
learning means that a model does not have to be trained, and we do not need a "target"
variable. This method can be used on any data to visualize and interpret the relationship
between individual data points.
Hierarchical clustering is separating data into groups based on some measure of similarity,
finding a way to measure how they’re alike and different, and further narrowing down the
data.
Here we will use hierarchical clustering to group data points and visualize the clusters using
both a dendrogram and scatter plot.
Hierarchical clustering requires us to decide on both a distance and linkage method. We will use
euclidean distance and the Ward linkage method, which attempts to minimize the variance
between clusters.
What is Dendrogram?
import numpy as np
import matplotlib.pyplot as plt
plt.scatter(x, y)
plt.show()
Example code:
import numpy as np
import matplotlib.pyplot as plt
from scipy.cluster.hierarchy import dendrogram, linkage
plt.show()
Conclusion: