本文簡要介紹 python 語言中 scipy.cluster.hierarchy.maxinconsts
的用法。
用法:
scipy.cluster.hierarchy.maxinconsts(Z, R)#
返回每個非單例集群及其子集群的最大不一致性係數。
- Z: ndarray
層次聚類編碼為矩陣。有關詳細信息,請參閱
linkage
。- R: ndarray
不一致矩陣。
- MI: ndarray
一個單調的
(n-1)
大小的 numpy 雙精度數組。
參數 ::
返回 ::
例子:
>>> from scipy.cluster.hierarchy import median, inconsistent, maxinconsts >>> 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) >>> Z array([[ 0. , 1. , 1. , 2. ], [ 3. , 4. , 1. , 2. ], [ 9. , 10. , 1. , 2. ], [ 6. , 7. , 1. , 2. ], [ 2. , 12. , 1.11803399, 3. ], [ 5. , 13. , 1.11803399, 3. ], [ 8. , 15. , 1.11803399, 3. ], [11. , 14. , 1.11803399, 3. ], [18. , 19. , 3. , 6. ], [16. , 17. , 3.5 , 6. ], [20. , 21. , 3.25 , 12. ]]) >>> 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.maxinconsts
可用於計算每個非單例集群及其子集群的不一致統計量的最大值(R
的最後一列):>>> maxinconsts(Z, R) array([0. , 0. , 0. , 0. , 0.70710678, 0.70710678, 0.70710678, 0.70710678, 1.15470054, 1.15470054, 1.15470054])
相關用法
- Python SciPy hierarchy.maxRstat用法及代碼示例
- Python SciPy hierarchy.maxdists用法及代碼示例
- Python SciPy hierarchy.median用法及代碼示例
- Python SciPy hierarchy.ward用法及代碼示例
- Python SciPy hierarchy.set_link_color_palette用法及代碼示例
- Python SciPy hierarchy.fclusterdata用法及代碼示例
- Python SciPy hierarchy.DisjointSet用法及代碼示例
- Python SciPy hierarchy.correspond用法及代碼示例
- Python SciPy hierarchy.is_isomorphic用法及代碼示例
- Python SciPy hierarchy.optimal_leaf_ordering用法及代碼示例
- Python SciPy hierarchy.cut_tree用法及代碼示例
- Python SciPy hierarchy.fcluster用法及代碼示例
- Python SciPy hierarchy.to_tree用法及代碼示例
- Python SciPy hierarchy.average用法及代碼示例
- Python SciPy hierarchy.dendrogram用法及代碼示例
- Python SciPy hierarchy.num_obs_linkage用法及代碼示例
- Python SciPy hierarchy.inconsistent用法及代碼示例
- Python SciPy hierarchy.complete用法及代碼示例
- Python SciPy hierarchy.linkage用法及代碼示例
- Python SciPy hierarchy.is_valid_im用法及代碼示例
- Python SciPy hierarchy.centroid用法及代碼示例
- Python SciPy hierarchy.single用法及代碼示例
- Python SciPy hierarchy.is_monotonic用法及代碼示例
- Python SciPy hierarchy.cophenet用法及代碼示例
- Python SciPy hierarchy.leaves_list用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.cluster.hierarchy.maxinconsts。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。