Closed seanareed closed 7 years ago
Sorry for the late reply, I will be checking it tonight but it seems to be a bug.
Ok so I 've looked into it a bit and I am sorry to tell you that it is not a bug. Given just a dendrogram it is not always possible to extract a specific number of clusters. I will try to illustrate my point using the following image.
So you see given just the dendrogram there is no way to create 4 clusters. I 'll leave the issue open for a few more days if you want to add something more. By the way it is also mentioned in the comment of the function dendrogramToClusters()
Your explanation makes total sense.
No need to leave the issue open on my account, since I think it's clear that the result is a limitation of the source data and not a software issue.
Thanks!
Cool! But maybe I should add a suggestion for enhancement because if the cluster()
method also returns the order of the joins in the dendrogram, then there may be a possibility to extract exactly N clusters.
Anyway, thanks for understanding and thanks for the issue.
I'm sometimes getting 5 clusters back when I'm specifying 4.
Is this expected?
Example:
Result (formatted for JSON response):
Changing the source data to the following works as I expect: