I am doing a hierarchical agglomerative clustering. Everything is working fine, but I want to do representation of t vs. number of cluster of the dendrogram.
The only info about the dendrogram is the Z
matix in the following code, but I don't know what the clust matrix mean.
import seaborn as sns
import scipy.cluster.hierarchy as sch
from scipy.cluster.hierarchy import dendrogram, linkage, fcluster
iris = sns.load_dataset("iris")
species = iris.pop("species")
Z = linkage(X, 'ward')
fig = plt.figure(figsize=(25, 10))
dn = dendrogram(Z)
So for this case I would have (number of cluster,t) the values of (2,30) , (3,10) and so on, but the closer we get to t=0 the harder it is to count all