scipy.cluster.hierarchy.maxRstat¶
- scipy.cluster.hierarchy.maxRstat(Z, R, i)[源代码]¶
返回每个非单一群集及其子群集的最大统计信息。
- 参数
- Zarray_like
分层聚类被编码为矩阵。看见
linkage
了解更多信息。- Rarray_like
不一致矩阵。
- i集成
的栏目 R 用作统计数据。
- 退货
- MRndarray
计算不一致矩阵第i列的最大统计量 R 对于每个非单例群集节点。
MR[j]
是不是超过最大值了?R[Q(j)-n, i]
,在哪里Q(j)
与下面的节点相对应的所有节点ID的集合,包括j
。
参见
linkage
有关链接矩阵是什么的说明,请参阅。
inconsistent
用于创建不一致矩阵。
示例
>>> from scipy.cluster.hierarchy import median, inconsistent, maxRstat >>> from scipy.spatial.distance import pdist
给定一个数据集
X
,我们可以应用聚类方法来获得链接矩阵Z
。scipy.cluster.hierarchy.inconsistent
也可以用来获得不一致矩阵R
与此群集进程关联:>>> X = [[0, 0], [0, 1], [1, 0], ... [0, 4], [0, 3], [1, 4], ... [4, 0], [3, 0], [4, 1], ... [4, 4], [3, 4], [4, 3]]
>>> Z = median(pdist(X)) >>> R = inconsistent(Z) >>> R array([[1. , 0. , 1. , 0. ], [1. , 0. , 1. , 0. ], [1. , 0. , 1. , 0. ], [1. , 0. , 1. , 0. ], [1.05901699, 0.08346263, 2. , 0.70710678], [1.05901699, 0.08346263, 2. , 0.70710678], [1.05901699, 0.08346263, 2. , 0.70710678], [1.05901699, 0.08346263, 2. , 0.70710678], [1.74535599, 1.08655358, 3. , 1.15470054], [1.91202266, 1.37522872, 3. , 1.15470054], [3.25 , 0.25 , 3. , 0. ]])
scipy.cluster.hierarchy.maxRstat
可用于计算每列的最大值R
,对于每个非单身群集及其子群集:>>> maxRstat(Z, R, 0) array([1. , 1. , 1. , 1. , 1.05901699, 1.05901699, 1.05901699, 1.05901699, 1.74535599, 1.91202266, 3.25 ]) >>> maxRstat(Z, R, 1) array([0. , 0. , 0. , 0. , 0.08346263, 0.08346263, 0.08346263, 0.08346263, 1.08655358, 1.37522872, 1.37522872]) >>> maxRstat(Z, R, 3) array([0. , 0. , 0. , 0. , 0.70710678, 0.70710678, 0.70710678, 0.70710678, 1.15470054, 1.15470054, 1.15470054])