Search code examples
matlabtreecluster-analysishierarchicallinkage

How to create balanced tree in matlab


I'm trying to build a tree in matlab through hierarchical clustering.

I tried using the linkage function doing:

z=linkage(data);
dendrogram(z);

It worked fine but the resulting tree was very unbalanced (http://oi61.tinypic.com/6sasgl.jpg).

Is there a way of doing hierarchical clustering and obtaining a balanced tree?

Thank you in advance.

Raul


Solution

  • There are a number of options you can set in linkage, and it would be worth your time to examine them all in detail (also have a look at what sort of distance metrics other people are using for data similar to yours).

    For example, using the inbuilt fisheriris set:

    Z = linkage(meas); %default settings
    Z2 = linkage(meas,'ward'); %Ward linkage
    

    enter image description here