scipy 链接格式 [英] scipy linkage format

查看:21
本文介绍了scipy 链接格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了自己的聚类例程,并想生成一个树状图.最简单的方法是使用 scipy 树状图函数.但是,这要求输入与 scipy 链接函数生成的格式相同.我找不到有关如何格式化输出的示例.我想知道是否有人可以启发我.

I have written my own clustering routine and would like to produce a dendrogram. The easiest way to do this would be to use scipy dendrogram function. However, this requires the input to be in the same format that the scipy linkage function produces. I cannot find an example of how the output of this is formatted. I was wondering whether someone out there can enlighten me.

推荐答案

这是来自 scipy.cluster.hierarchy.linkage() 函数文档,我认为这是对输出格式的非常清楚的描述:

This is from the scipy.cluster.hierarchy.linkage() function documentation, I think it's a pretty clear description for the output format:

A (n-1) 乘以 4 矩阵 Z 被返回.在第 i 次迭代中,索引为 Z[i, 0] 和 Z[i, 1] 的簇被组合成簇 n + i.索引小于 n 的集群对应于原始观察之一.簇 Z[i, 0] 和 Z[i, 1] 之间的距离由 Z[i, 2] 给出.第四个值 Z[i, 3] 表示新形成的聚类中原始观测值的数量.

A (n-1) by 4 matrix Z is returned. At the i-th iteration, clusters with indices Z[i, 0] and Z[i, 1] are combined to form cluster n + i. A cluster with an index less than n corresponds to one of the original observations. The distance between clusters Z[i, 0] and Z[i, 1] is given by Z[i, 2]. The fourth value Z[i, 3] represents the number of original observations in the newly formed cluster.

你还需要什么吗?

这篇关于scipy 链接格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆