Agglomerative hierarchical clustering starts with every data point as its own cluster, then repeatedly merges the two closest clusters until only one remains. The floor of this scene holds customer points (say, by spend and visit frequency); the tree rising above it is the dendrogram — each branch fork is a merge, and its height is the distance at which that merge happened.
fcluster(Z, t, criterion='distance'); slide it to change how many clusters you get.Unlike k-means, hierarchical clustering never needs a chosen number of clusters up front — you build the whole tree once, then decide where to cut it. The height at which two points first merge is called their cophenetic distance, and comparing it to the true pairwise distance (the cophenetic correlation) is a common way to judge how well a dendrogram represents the original data.
Watch agglomerative hierarchical clustering merge customer data points into a 3D dendrogram tree step by step, compare linkage methods, and slide a cut-height plane to carve out flat clusters.
Each branch fork in the rising tree is a merge of the two nearest clusters; its height is the distance at which they merged. The linkage method changes which pair counts as "nearest," reshaping the whole tree.
Pick a linkage method and point count, then slide the cut-height plane up and down — every branch it crosses splits into a separate, distinctly colored flat cluster on the ground below.
Because the full tree is built once, changing the cut height is instant — no re-clustering needed, unlike k-means where changing k means starting over.