3
$\begingroup$

So I am clustering my data using linkage extensions. When I plot the diagrams of the dendrograms scipy chooses to color branches in different colors according to a "color threshold". As I understand it we have at some time $t$ a clustering of the data: some points are "glued together" while others are still to far away from each other (distance greater than $t$) to have become glued. At this moment the algorithm marks each cluster with a distinct color. After $t$ the emerging new clusters will be colored red. Please see the two examples of my dendrograms below.

cityblock metric, ward linkage

city block metric, average linkage

I dont't really think I understand the coloring, because if what I said was true, then why is the top part of the second picture all red? Because in the first dendrogram we see three distinct colors, indicating clusters that has emerged at time $t$, then when $t$ grows we have the subsequent clusters until everything is glued together. So what is the interpretation of the coloring? Here I am using $\texttt{scipy.cluster.hierarchy.dendrogram}$ and the documentation can be found here.

$\endgroup$
1
  • $\begingroup$ Hi. Did you find the answer? If so, please provide it here if you can as others like me may get some benefit. Thanks. $\endgroup$
    – Nima S
    Jul 21, 2021 at 3:59

1 Answer 1

1
$\begingroup$

The default value of t from the documentation is 0.7*max(Z[:,2]) where Z is the linkage matrix that you pass to the dendrogram function. When you use different linkages, in your case ward and average, you obtain different values and scales for the distance between clusters. Thus, the value for t is different in both dendrogram.

If the two methods are not related via a monotonic function (and I believe they do not in this case), then the default t value will not cover the same nodes for each dendrogram.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.