Plot dendrogram using sklearn.AgglomerativeClustering

后端 未结 5 1153
刺人心
刺人心 2021-01-31 15:17

I\'m trying to build a dendrogram using the children_ attribute provided by AgglomerativeClustering, but so far I\'m out of luck. I can\'t use sc

5条回答
  •  醉梦人生
    2021-01-31 15:28

    Use the scipy implementation of agglomerative clustering instead. Here is an example.

    from scipy.cluster.hierarchy import dendrogram, linkage
    
    data = [[0., 0.], [0.1, -0.1], [1., 1.], [1.1, 1.1]]
    
    Z = linkage(data)
    
    dendrogram(Z)  
    

    You can find documentation for linkage here and documentation for dendrogram here.

提交回复
热议问题