当前位置:网站首页>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
边栏推荐
猜你喜欢

Exception(异常) 和 Error(错误)区别解析

3. 无重复字符的最长子串

junit总结

typescript39-class类的可见修饰符

web安全-PHP反序列化漏洞

typescript46-函数之间的类型兼容性

Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)

web安全-SSTI模板注入漏洞

Harmony OS Date ano UI 】 【 】 the basic operation

js implements a bind function
随机推荐
Kaggle(四)Scikit-learn
[Fine talk] Using native js to implement todolist
flask 面试题 问题
Redis常用命令
Interface Test Framework Practice | Process Encapsulation and Test Case Design Based on Encrypted Interface
Power button 561. An array of split
js implements a bind function
Js学习笔记(四)
Practical application of WebSocket
Talking about GIS Data (6) - Projected Coordinate System
High availability, two locations and three centers
UV decomposition of biotin - PEG2 - azide | CAS: 1192802-98-4 biotin connectors
HarmonyOS应用开发第一次培训
信息编码、存储压缩与密码学
typescript42-readonly修饰符
内部类、static关键字、final
PotPlayer实现上班摸鱼电视自由
快速上手 Mockito 单元测试框架
Installation of Apache DolphinScheduler version 2.0.5 distributed cluster
web安全-PHP反序列化漏洞