当前位置:网站首页>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
边栏推荐
- 生活原则。
- GIS数据漫谈(六)— 投影坐标系统
- GIS数据漫谈(五)— 地理坐标系统
- 数字孪生园区场景中的坐标知识
- Create a tree structure
- typescript40-class类的保护修饰符
- Interface Test Framework Practice | Process Encapsulation and Test Case Design Based on Encrypted Interface
- Newifi路由器第三方固件玩机教程,这个路由比你想的更强大以及智能_Newifi y1刷机_smzdm
- 2. 两数相加
- Concepts and Methods of Exploratory Testing
猜你喜欢
Pr第三次培训笔记
typescript47-函数之间的类型兼容性
Common lipophilic cell membrane dyes DiO, Dil, DiR, Did spectrograms and experimental procedures
typescript40-class类的保护修饰符
Modified BiotinDIAZO-Biotin-PEG3-DBCO|diazo-biotin-tripolyethylene glycol-diphenylcyclooctyne
Interface test practice | Detailed explanation of the difference between GET / POST requests
VR全景展打造专属元宇宙观展空间
flask 面试题 问题
Redis常用命令
web安全-命令执行漏洞
随机推荐
13.
lt.647. Palindromic substring + lt.516. Longest palindrome subsequence 如何不耍流氓的做运维之-SHELL脚本
Technology Sharing | How to do assertion verification for xml format in interface automation testing?
typescript47-函数之间的类型兼容性
IO process thread -> thread -> day5
ss-2.子项目互相访问(order80 -> payment8001)
力扣561. 数组拆分
Presto installation and deployment tutorial
【 Harmony OS 】 【 ano UI 】 lightweight data storage
Harmony OS ets ArkUI 】 【 】 the development basic page layout and data connection
User password verification
Benchmark 第一篇 了解Benchmark
反射注解基础
idea uses @Autowired annotation to explain the reasons and solutions
Interface test framework combat (1) | Requests and interface request construction
Interface testing framework combat (3) | JSON request and response assertion
初步认识ZK
Interface testing framework of actual combat (2) | interface request assertion
高可用 两地三中心
Concepts and Methods of Exploratory Testing