本文整理汇总了Python中scipy.cluster.hierarchy.from_mlab_linkage函数的典型用法代码示例。如果您正苦于以下问题:Python from_mlab_linkage函数的具体用法?Python from_mlab_linkage怎么用?Python from_mlab_linkage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了from_mlab_linkage函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_mlab_linkage_conversion_multiple_rows
def test_mlab_linkage_conversion_multiple_rows(self):
# Tests from/to_mlab_linkage on linkage array with multiple rows.
Zm = np.asarray([[3, 6, 138], [4, 5, 219],
[1, 8, 255], [2, 9, 268], [7, 10, 295]])
Z = np.array([[2., 5., 138., 2.],
[3., 4., 219., 2.],
[0., 7., 255., 3.],
[1., 8., 268., 4.],
[6., 9., 295., 6.]],
dtype=np.double)
assert_equal(from_mlab_linkage(Zm), Z)
assert_equal(to_mlab_linkage(Z), Zm)
开发者ID:abudulemusa,项目名称:scipy,代码行数:12,代码来源:test_hierarchy.py
示例2: test_mlab_linkage_conversion_multiple_rows
def test_mlab_linkage_conversion_multiple_rows(self):
# Tests from/to_mlab_linkage on linkage array with multiple rows.
Zm = np.asarray([[3, 6, 138], [4, 5, 219], [1, 8, 255], [2, 9, 268], [7, 10, 295]])
Z = np.array(
[
[2.0, 5.0, 138.0, 2.0],
[3.0, 4.0, 219.0, 2.0],
[0.0, 7.0, 255.0, 3.0],
[1.0, 8.0, 268.0, 4.0],
[6.0, 9.0, 295.0, 6.0],
],
dtype=np.double,
)
assert_equal(from_mlab_linkage(Zm), Z)
assert_equal(to_mlab_linkage(Z), Zm)
开发者ID:Kitchi,项目名称:scipy,代码行数:15,代码来源:test_hierarchy.py
示例3: show_dendrogram
def show_dendrogram(Z, **kwargs):
from scipy.cluster.hierarchy import dendrogram, from_mlab_linkage
from matplotlib import pyplot as plt
dendrogram(from_mlab_linkage(Z), **kwargs)
plt.show()
开发者ID:avesloguzova,项目名称:spbau_homework,代码行数:6,代码来源:alexandra_vesloguzova.py
示例4: test_mlab_linkage_conversion_single_row
def test_mlab_linkage_conversion_single_row(self):
# Tests from/to_mlab_linkage on linkage array with single row.
Z = np.asarray([[0., 1., 3., 2.]])
Zm = [[1, 2, 3]]
assert_equal(from_mlab_linkage(Zm), Z)
assert_equal(to_mlab_linkage(Z), Zm)
开发者ID:abudulemusa,项目名称:scipy,代码行数:6,代码来源:test_hierarchy.py
示例5: test_mlab_linkage_conversion_empty
def test_mlab_linkage_conversion_empty(self):
# Tests from/to_mlab_linkage on empty linkage array.
X = np.asarray([])
assert_equal(from_mlab_linkage([]), X)
assert_equal(to_mlab_linkage([]), X)
开发者ID:abudulemusa,项目名称:scipy,代码行数:5,代码来源:test_hierarchy.py
示例6:
import scipy.cluster.hierarchy as hcluster
import numpy as np
import matplotlib.pyplot as plt
chained_linkage = np.array([[1, 2, 1], [9, 3, 2], [10, 4, 3], [11, 5, 4], [12, 6, 5], [13, 7, 6], [14, 8, 7]])
chained_linkage = hcluster.from_mlab_linkage(chained_linkage)
perfect_linkage = hcluster.from_mlab_linkage(np.array([[1,2,1], [3,4,1], [5,6,1], [7,8,1], [9,10,2], [11,12,2], [13,14,3]]))
hcluster.dendrogram(perfect_linkage, color_threshold=0)
plt.savefig('perfect_linkage.pdf')
plt.close('all')
hcluster.dendrogram(chained_linkage, color_threshold=0)
plt.savefig('worst_case_linkage.pdf')
plt.close('all')
开发者ID:lukauskas,项目名称:honours-project-report,代码行数:14,代码来源:generate_figures.py
示例7: check_linkage_q
def check_linkage_q(self, method):
# Tests linkage(Y, method) on the Q data set.
Z = linkage(eo['Q-X'], method)
Zmlab = eo['linkage-Q-%s' % method]
expectedZ = from_mlab_linkage(Zmlab)
assert_allclose(Z, expectedZ, atol=1e-06)
开发者ID:FrankZhao66,项目名称:scipy,代码行数:6,代码来源:test_hierarchy.py
示例8: check_linkage_tdist
def check_linkage_tdist(self, method):
# Tests linkage(Y, method) on the tdist data set.
Z = linkage(_ytdist, method)
Zmlab = eo['linkage-%s-tdist' % method]
expectedZ = from_mlab_linkage(Zmlab)
assert_allclose(Z, expectedZ, atol=1e-10)
开发者ID:FrankZhao66,项目名称:scipy,代码行数:6,代码来源:test_hierarchy.py
注:本文中的scipy.cluster.hierarchy.from_mlab_linkage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论