Group Abstract Group Abstract

Message Boards Message Boards

2
|
4.3K Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Symbolic representation for dendrograms and clustering trees?

Posted 10 years ago

Mathematica 10.4 includes new functions for dendrograms. So far I found Dendrogram and ClusteringTree. Both take unclustered data as input and output a visualization.

But is there a way to obtain a symbolic representation of a dendrogram, i.e. to separate the clustering and the visualization steps? This would be useful in many cases, such as

  • producing the dendrogram data in another way and plotting it with Mathematica,
  • or doing manipulations on the dendrogram data, such as truncating it for clearer visualization
  • or using a completely different visualization function to plot dendrogram data computed with Mathematica. For example, one might want to highlight the clusters in colour given some cutoff. Or plot a radial dendrogram instead.

MATLAB works like this: it has the computation and visualization steps separated, and it has a representation for dendrograms that can be used for computation (not only visualization). http://www.mathworks.com/help/stats/dendrogram.html Then people can easily extend its dendrogram functionality.

The old HierarchicalClustering Mathematica package also separates these two steps: it has DirectAgglomerate and DendrogramPlot. But that package is outdated in many other ways and was long due for an update.

Note that the output of ClusteringTree is a Graph (not just graphics), but that is not suitable as such a representation because it does not include the dissimilarity values. Nor can it be directly plotted as a dendrogram.

POSTED BY: Szabolcs Horvát

I was wondering the same thing, with some trace magic I found a symbolic version of the graph (I only needed it once, so this was OK for me):

out=Quiet[Cases[Dendrogram[{1,2,5,3.3}]//Trace,Association[___],\[Infinity]]];
out=Quiet[Select[out,KeyExistsQ[#,"Edges"]\[And]KeyExistsQ[#,"NamesAssociation"]&]];
out=Last[out]
Dendrogram[{1,2,5,3.3}]

out:

<|"Edges" -> {1 -> 2, 2 -> 3, 3 -> 4, 3 -> 5, 2 -> 6, 1 -> 7}, 
 "NamesAssociation" -> <|1 -> {{{1, 2}, 3.3}, 5}, 2 -> {{1, 2}, 3.3}, 
   3 -> {1, 2}, 4 -> 1, 5 -> 2, 6 -> 3.3, 7 -> 5|>|>

enter image description here

Perhaps if you dig a little in the Trace you can find the actual command...

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard