更新时间:2022-12-30 18:23:01
只需将指标更改为correlation
,以使第一行变为:
Just change the metric to correlation
so that the first line becomes:
Y=pdist(X, 'correlation')
但是,我认为代码可以简化为:
However, I believe that the code can be simplified to just:
Z=linkage(X, 'single', 'correlation')
dendrogram(Z, color_threshold=0)
因为链接将为您处理pdist.
because linkage will take care of the pdist for you.