栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

在scipy.cluster.hierarchy.linkage()中使用距离矩阵?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在scipy.cluster.hierarchy.linkage()中使用距离矩阵?

似乎确实不能直接传递冗余方阵,尽管文档声称可以这样做。

为了使将来遇到相同问题的任何人受益,我在此处写我的解决方案作为附加答案。因此,复制粘贴人员可以继续进行聚类。

使用以下代码段压缩矩阵并愉快地进行。

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

如果我错了,请纠正我。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/614117.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号