I am following the example code in the linkage documentation:
from scipy.cluster.hierarchy import dendrogram, linkage
from matplotlib import pyplot as plt
Z = linkage(X, 'single')
fig = plt.figure(figsize=(25, 10))
dn = dendrogram(Z)
plt.show()
The linkage matrix Z is:
array([[ 2, 7, 0, 2], # This becomes object #8
[ 5, 6, 0, 2], # This becomes object #9
[ 0, 4, 1, 2], # This becomes object #10
[ 8, 10, 1, 4], # Merge #8 and #10
[ 1, 9, 1, 3],
[ 3, 11, 2, 5],
[12, 13, 4, 8]])
- The merging of #2 and #7 creates #8
- The merging of #0 and #4 creates #10
- #8 clearly merges with #10 after the merging of #0 and #4
- In contrast, the dendrogram shows the merging of #0, #4, and #8 in one merge operation
I'm new to clustering. Am I simply misunderstanding how linkages and dendograms work, or is this unintended behaviour?
