예제 #1
0
 def check_maxRstat_Q_linkage(self, method, i):
     # Tests maxRstat(Z, R, i) on the Q data set
     X = hierarchy_test_data.Q_X
     Z = linkage(X, method)
     R = inconsistent(Z)
     MD = maxRstat(Z, R, 1)
     expectedMD = calculate_maximum_inconsistencies(Z, R, 1)
     assert_allclose(MD, expectedMD, atol=1e-15)
예제 #2
0
 def test_is_valid_im_4_and_up(self):
     # Tests is_valid_im(R) on im on observation sets between sizes 4 and 15
     # (step size 3).
     for i in xrange(4, 15, 3):
         y = np.random.rand(i * (i - 1) // 2)
         Z = linkage(y)
         R = inconsistent(Z)
         assert_(is_valid_im(R) == True)
예제 #3
0
 def check_maxRstat_Q_linkage(self, method, i):
     # Tests maxRstat(Z, R, i) on the Q data set
     X = hierarchy_test_data.Q_X
     Z = linkage(X, method)
     R = inconsistent(Z)
     MD = maxRstat(Z, R, 1)
     expectedMD = calculate_maximum_inconsistencies(Z, R, 1)
     assert_allclose(MD, expectedMD, atol=1e-15)
예제 #4
0
 def test_is_valid_im_4_and_up(self):
     # Tests is_valid_im(R) on im on observation sets between sizes 4 and 15
     # (step size 3).
     for i in xrange(4, 15, 3):
         y = np.random.rand(i*(i-1)//2)
         Z = linkage(y)
         R = inconsistent(Z)
         assert_(is_valid_im(R) == True)
예제 #5
0
 def test_is_valid_im_4_and_up_neg_dist(self):
     # Tests is_valid_im(R) on im on observation sets between sizes 4 and 15
     # (step size 3) with negative link counts.
     for i in xrange(4, 15, 3):
         y = np.random.rand(i * (i - 1) // 2)
         Z = linkage(y)
         R = inconsistent(Z)
         R[i // 2, 2] = -0.5
         assert_(is_valid_im(R) == False)
         assert_raises(ValueError, is_valid_im, R, throw=True)
예제 #6
0
 def test_is_valid_im_4_and_up_neg_dist(self):
     # Tests is_valid_im(R) on im on observation sets between sizes 4 and 15
     # (step size 3) with negative link counts.
     for i in xrange(4, 15, 3):
         y = np.random.rand(i*(i-1)//2)
         Z = linkage(y)
         R = inconsistent(Z)
         R[i//2,2] = -0.5
         assert_(is_valid_im(R) == False)
         assert_raises(ValueError, is_valid_im, R, throw=True)
예제 #7
0
 def check_inconsistent_tdist(self, depth):
     Z = hierarchy_test_data.linkage_ytdist_single
     assert_allclose(inconsistent(Z, depth),
                     hierarchy_test_data.inconsistent_ytdist[depth])
예제 #8
0
 def check_inconsistent_tdist(self, depth):
     Z = hierarchy_test_data.linkage_ytdist_single
     assert_allclose(inconsistent(Z, depth),
                     hierarchy_test_data.inconsistent_ytdist[depth])