当前位置:网站首页>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
边栏推荐
- typescript44-对象之间的类兼容器
- 传说中可“免费白拿”的无线路由器 - 斐讯 K2 最简单刷 breed 与第三方固件教程
- ss-4.1-1个eurekaServer+1个providerPayment+1个consumerOrder
- High availability, two locations and three centers
- 业务表解析-余额系统
- idea使用@Autowired注解爆红原因及解决方法
- Get the Ip tool class
- 1054 求平均值 (20 分)
- Business table analysis - balance system
- Two ways to simulate multi-user login in Jmeter
猜你喜欢
![[Harmony OS] [ArkUI] ets development graphics and animation drawing](/img/36/f4c91f794b1321f11a24505d1617fb.png)
[Harmony OS] [ArkUI] ets development graphics and animation drawing

在树莓派上搭建属于自己的网页(2)

传说中可“免费白拿”的无线路由器 - 斐讯 K2 最简单刷 breed 与第三方固件教程

MCM box model modeling method and source analysis of atmospheric O3

typescript43-类型兼容性说明

web安全-命令执行漏洞

Build your own web page on the Raspberry Pi (2)

JS学习笔记(三)

2. 两数相加

数字孪生园区场景中的坐标知识
随机推荐
用户密码验证
Interface test Mock combat (2) | Combined with jq to complete batch manual Mock
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
vim命令
Ali cloud object storage oss private barrels to generate links
Build your own web page on the Raspberry Pi (2)
在树莓派上搭建属于自己的网页(1)
阿里云对象存储oss私有桶生成链接
Online password generator tool recommendation
ss-4.2 多个eureka集群案例
presto安装部署教程
Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)
web安全-sql注入漏洞
Unity2D horizontal board game tutorial 6 - enemy AI and attack animation
Alienware上线首个数字时装AR试穿体验
Practical application of WebSocket
PotPlayer实现上班摸鱼电视自由
Interface test framework combat (1) | Requests and interface request construction
Djiango第三次培训
C# async and multithreading