How do I retrieve groupwise leaf nodes with Hierarchical Clustering?

1 visualización (últimos 30 días)
I am using Hierarchical Clustering wants to know how to retrieve the leaf nodes for each cluster groups.
To give you the idea, please refer to the illustration just above the "Dendrograms."
I would like to find:
    Group 6: 4, 5
    Group 7: 1, 3
    Group 8: 1, 3, 4, 5
    (The enclosing group necessarily includes all: 1, 2, 3, 4, 5)

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 2 de Mzo. de 2021
Editada: MathWorks Support Team el 2 de Mzo. de 2021
As of MATLAB R2015a, a function for retrieving groupwise leaf nodes with Hierarchical Clustering is not available.
As a workaround consider the following script:
    rng default;  % For reproducibility
    X = [1   2; ...
         2.5 4.5; ...
         2   2; ...
         4   1.5;...
         4   2.5];
    Y = pdist(X);
    Z = linkage(Y);
    dendrogram(Z);
    % A
    n = size(Z,1)+1;
    v = eye(n,n*2-1)>0;
    for i = 1:n-1 
        v(:,i+n) = any(v(:,Z(i,[1 2])),2); 
    end
    v = v(:,n+1:end)
    % B
    [index_row , index_column] = ind2sub(size(v), find(v));
    index_row(index_column == 1).'
    index_row(index_column == 2).'
    index_row(index_column == 3).'

Más respuestas (0)

Etiquetas

Aún no se han introducido etiquetas.

Productos


Versión

R2013b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by