コード例 #1
0
 def check_maxdists_Q_linkage(self, method):
     # Tests maxdists(Z) on the Q data set
     X = hierarchy_test_data.Q_X
     Z = linkage(X, method)
     MD = maxdists(Z)
     expectedMD = calculate_maximum_distances(Z)
     assert_allclose(MD, expectedMD, atol=1e-15)
コード例 #2
0
 def check_maxdists_Q_linkage(self, method):
     # Tests maxdists(Z) on the Q data set
     X = hierarchy_test_data.Q_X
     Z = linkage(X, method)
     MD = maxdists(Z)
     expectedMD = calculate_maximum_distances(Z)
     assert_allclose(MD, expectedMD, atol=1e-15)
コード例 #3
0
 def test_maxdists_one_cluster_linkage(self):
     # Tests maxdists(Z) on linkage with one cluster.
     Z = np.asarray([[0, 1, 0.3, 4]], dtype=np.double)
     MD = maxdists(Z)
     expectedMD = calculate_maximum_distances(Z)
     assert_allclose(MD, expectedMD, atol=1e-15)
コード例 #4
0
 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))
コード例 #5
0
 def test_maxdists_one_cluster_linkage(self):
     # Tests maxdists(Z) on linkage with one cluster.
     Z = np.asarray([[0, 1, 0.3, 4]], dtype=np.double)
     MD = maxdists(Z)
     expectedMD = calculate_maximum_distances(Z)
     assert_allclose(MD, expectedMD, atol=1e-15)
コード例 #6
0
 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))