• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python hierarchy.is_isomorphic函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python hierarchy.is_monotonic函数代码示例发布时间:2022-05-27
下一篇:
Python hierarchy.inconsistent函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap