当前位置:网站首页>Length n of condensed distance matrix ‘y‘ must be a binomial coefficient
Length n of condensed distance matrix ‘y‘ must be a binomial coefficient
2022-08-03 05:10:00 【xiaozheng123121】
在利用层次聚类算法的时候,报错:
ValueError: Length n of condensed distance matrix 'y' must be a binomial coefficient, i.e.there must be a k such that (k \choose 2)=n)!
import scipy.cluster.hierarchy as hcluster
df = df.iloc[:2000, :].apply(lambda x: sum(x), axis=1)
linkage = hcluster.linkage(df, method='centroid')
注:我的df是一个Series,而不是dataframe,改成Dataframe格式即可
linkage = hcluster.linkage(pd.DataFrame(df), method='centroid')
参考资料
[1] scipy.cluster.hierarchy.linkage 2020.5
边栏推荐
猜你喜欢
第三次HarmonyOS培训
Two ways to simulate multi-user login in Jmeter
内部类、static关键字、final
网络流媒体下载的 10 种方法(以下载 Echo 音乐为例)
VR全景展打造专属元宇宙观展空间
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
接口和抽象
UV decomposition of biotin - PEG2 - azide | CAS: 1192802-98-4 biotin connectors
Shell conditional statement judgment
Redis6学习笔记
随机推荐
HarmonyOS应用开发第一次培训
Practical application of WebSocket
Flink state
idea uses @Autowired annotation to explain the reasons and solutions
Installation of Apache DolphinScheduler version 2.0.5 distributed cluster
2022暑假牛客多校联赛第一场
背压机制
反射注解基础
VR全景展打造专属元宇宙观展空间
Redis6学习笔记
Flask的简单介绍及使用方法简介
《录取通知》 观后感
Junit
GIS数据漫谈(六)— 投影坐标系统
Tributyl-mercaptophosphane "tBuBrettPhos Pd(allyl)" OTf), 1798782-17-8
[Fine talk] Using native js to implement todolist
MOSN 反向通道详解
1058 选择题 (20 分)(C语言)
建立树形结构
typescript49-交叉类型