当前位置: 首页>>代码示例>>Python>>正文


Python hierarchy.is_isomorphic函数代码示例

本文整理汇总了Python中scipy.cluster.hierarchy.is_isomorphic函数的典型用法代码示例。如果您正苦于以下问题:Python is_isomorphic函数的具体用法?Python is_isomorphic怎么用?Python is_isomorphic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_isomorphic函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: help_is_isomorphic_randperm

 def help_is_isomorphic_randperm(self, nobs, nclusters, noniso=False, nerrors=0):
     for k in range(3):
         a = np.int_(np.random.rand(nobs) * nclusters)
         b = np.zeros(a.size, dtype=np.int_)
         P = np.random.permutation(nclusters)
         for i in xrange(0, a.shape[0]):
             b[i] = P[a[i]]
         if noniso:
             Q = np.random.permutation(nobs)
             b[Q[0:nerrors]] += 1
             b[Q[0:nerrors]] %= nclusters
         assert_(is_isomorphic(a, b) == (not noniso))
         assert_(is_isomorphic(b, a) == (not noniso))
开发者ID:abudulemusa,项目名称:scipy,代码行数:13,代码来源:test_hierarchy.py

示例2: check_fcluster

 def check_fcluster(self, t, criterion):
     # Tests fcluster(Z, criterion=criterion, t=t) on a random 3-cluster data set.
     expectedT = np.int_(eo['fclusterdata-%s-%d' % (criterion, t)])
     X = eo['Q-X']
     Y = pdist(X)
     Z = linkage(Y)
     T = fcluster(Z, criterion=criterion, t=t)
     assert_(is_isomorphic(T, expectedT))
开发者ID:FrankZhao66,项目名称:scipy,代码行数:8,代码来源:test_hierarchy.py

示例3: check_fcluster_monocrit

 def check_fcluster_monocrit(self, t, criterion):
     # Tests fcluster(Z, criterion='monocrit'/'maxclust_monocrit', t=t,
     # monicrit=maxdists(Z)) on a random 3-cluster data set.
     expectedT = np.int_(eo['fcluster-%s-%d' % (criterion, t)])
     X = eo['Q-X']
     Y = pdist(X)
     Z = linkage(Y)
     T = fcluster(Z, criterion=criterion, t=t, monocrit=maxdists(Z))
     assert_(is_isomorphic(T, expectedT))
开发者ID:FrankZhao66,项目名称:scipy,代码行数:9,代码来源:test_hierarchy.py

示例4: test_is_isomorphic_4C

 def test_is_isomorphic_4C(self):
     # Tests is_isomorphic on test case #4C (3 flat clusters, different labelings, isomorphic)
     a = [7, 2, 3]
     b = [6, 3, 2]
     assert_(is_isomorphic(a, b))
     assert_(is_isomorphic(b, a))
开发者ID:abudulemusa,项目名称:scipy,代码行数:6,代码来源:test_hierarchy.py

示例5: test_is_isomorphic_4B

 def test_is_isomorphic_4B(self):
     # Tests is_isomorphic on test case #4B (3 flat clusters, different labelings, nonisomorphic)
     a = [1, 2, 3, 3]
     b = [1, 3, 2, 3]
     assert_(is_isomorphic(a, b) == False)
     assert_(is_isomorphic(b, a) == False)
开发者ID:abudulemusa,项目名称:scipy,代码行数:6,代码来源:test_hierarchy.py

示例6: test_is_isomorphic_3

 def test_is_isomorphic_3(self):
     # Tests is_isomorphic on test case #3 (no flat clusters)
     a = []
     b = []
     assert_(is_isomorphic(a, b))
开发者ID:abudulemusa,项目名称:scipy,代码行数:5,代码来源:test_hierarchy.py

示例7: test_is_isomorphic_2

 def test_is_isomorphic_2(self):
     # Tests is_isomorphic on test case #2 (two flat clusters, different labelings)
     a = [1, 7, 1]
     b = [2, 3, 2]
     assert_(is_isomorphic(a, b))
     assert_(is_isomorphic(b, a))
开发者ID:abudulemusa,项目名称:scipy,代码行数:6,代码来源:test_hierarchy.py

示例8: test_is_isomorphic_1

 def test_is_isomorphic_1(self):
     # Tests is_isomorphic on test case #1 (one flat cluster, different labellings)
     a = [1, 1, 1]
     b = [2, 2, 2]
     assert_(is_isomorphic(a, b))
     assert_(is_isomorphic(b, a))
开发者ID:abudulemusa,项目名称:scipy,代码行数:6,代码来源:test_hierarchy.py

示例9: check_fcluster_maxclust_monocrit

 def check_fcluster_maxclust_monocrit(self, t):
     expectedT = hierarchy_test_data.fcluster_maxclust[t]
     Z = single(hierarchy_test_data.Q_X)
     T = fcluster(Z, t, criterion='maxclust_monocrit', monocrit=maxdists(Z))
     assert_(is_isomorphic(T, expectedT))
开发者ID:abudulemusa,项目名称:scipy,代码行数:5,代码来源:test_hierarchy.py

示例10: check_fcluster

 def check_fcluster(self, t, criterion):
     # Tests fcluster(Z, criterion=criterion, t=t) on a random 3-cluster data set.
     expectedT = getattr(hierarchy_test_data, 'fcluster_' + criterion)[t]
     Z = single(hierarchy_test_data.Q_X)
     T = fcluster(Z, criterion=criterion, t=t)
     assert_(is_isomorphic(T, expectedT))
开发者ID:abudulemusa,项目名称:scipy,代码行数:6,代码来源:test_hierarchy.py

示例11: test_is_isomorphic_7

 def test_is_isomorphic_7(self):
     # Regression test for gh-6271
     assert_(not is_isomorphic([1, 2, 3], [1, 1, 1]))
开发者ID:ElDeveloper,项目名称:scipy,代码行数:3,代码来源:test_hierarchy.py

示例12: check_fclusterdata

 def check_fclusterdata(self, t, criterion):
     # Tests fclusterdata(X, criterion=criterion, t=t) on a random 3-cluster data set.
     expectedT = getattr(hierarchy_test_data, "fcluster_" + criterion)[t]
     X = hierarchy_test_data.Q_X
     T = fclusterdata(X, criterion=criterion, t=t)
     assert_(is_isomorphic(T, expectedT))
开发者ID:Kitchi,项目名称:scipy,代码行数:6,代码来源:test_hierarchy.py


注:本文中的scipy.cluster.hierarchy.is_isomorphic函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。