为了使将来遇到相同问题的任何人受益,我在此处写我的解决方案作为附加答案。因此,复制粘贴人员可以继续进行聚类。
使用以下代码段压缩矩阵并愉快地进行。
import scipy.spatial.distance as ssd# convert the redundant n*n square matrix form into a condensed nC2 array distArray = ssd.squareform(distMatrix) # distArray[{n choose 2}-{n-i choose 2} + (j-i-1)] is the distance between points i and j
如果我错了,请纠正我。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)