当前位置:网站首页>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
边栏推荐
- Build your own web page on the Raspberry Pi (2)
- Business table analysis - balance system
- 背压机制
- typescript45-接口之间的兼容性
- 反射注解基础
- shell script loop statement
- 《录取通知》 观后感
- Apache DolphinScheduler版本2.0.5分布式集群的安装
- Interface testing framework of actual combat (2) | interface request assertion
- Interface test practice | Detailed explanation of the difference between GET / POST requests
猜你喜欢
随机推荐
用户密码加密工具
Detailed explanation of MOSN reverse channel
Installation of Apache DolphinScheduler version 2.0.5 distributed cluster
Kaggle 入门(Kaggle网站使用及项目复现)
网络流媒体下载的 10 种方法(以下载 Echo 音乐为例)
web安全-SSTI模板注入漏洞
Lambda表达式案例
初步认识ZK
CAD有生僻字如何打出来、如何提交软件相关问题或建议?
在树莓派上搭建属于自己的网页(2)
Djiango第三次培训
Two ways to simulate multi-user login in Jmeter
Presto installation and deployment tutorial
ss-4.1-1个eurekaServer+1个providerPayment+1个consumerOrder
Tributyl-mercaptophosphane "tBuBrettPhos Pd(allyl)" OTf), 1798782-17-8
1069 微博转发抽奖 (20 分)(C语言)
Modelarts第一次培训
Flink state
Exception (abnormal) and Error (error) difference analysis
设计模式——组合模式、享元模式(Integer缓存)(结构型模式)









