Exemplo n.º 1
0
 def test_num_obs_linkage_multi_matrix(self):
     # Tests num_obs_linkage with observation matrices of multiple sizes.
     for n in xrange(2, 10):
         X = np.random.rand(n, 4)
         Y = pdist(X)
         Z = linkage(Y)
         assert_equal(num_obs_linkage(Z), n)
Exemplo n.º 2
0
 def test_num_obs_linkage_multi_matrix(self):
     # Tests num_obs_linkage with observation matrices of multiple sizes.
     for n in xrange(2, 10):
         X = np.random.rand(n, 4)
         Y = pdist(X)
         Z = linkage(Y)
         assert_equal(num_obs_linkage(Z), n)
Exemplo n.º 3
0
 def test_num_obs_linkage_4_and_up(self):
     # Tests num_obs_linkage(Z) on linkage 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)
         assert_equal(num_obs_linkage(Z), i)
Exemplo n.º 4
0
 def test_num_obs_linkage_4_and_up(self):
     # Tests num_obs_linkage(Z) on linkage 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)
         assert_equal(num_obs_linkage(Z), i)
Exemplo n.º 5
0
 def test_num_obs_linkage_2x4(self):
     # Tests num_obs_linkage(Z) on linkage over 3 observations.
     Z = np.asarray([[0, 1, 3.0, 2], [3, 2, 4.0, 3]], dtype=np.double)
     assert_equal(num_obs_linkage(Z), 3)
Exemplo n.º 6
0
 def test_num_obs_linkage_1x4(self):
     # Tests num_obs_linkage(Z) on linkage over 2 observations.
     Z = np.asarray([[0, 1, 3.0, 2]], dtype=np.double)
     assert_equal(num_obs_linkage(Z), 2)
Exemplo n.º 7
0
 def test_num_obs_linkage_2x4(self):
     # Tests num_obs_linkage(Z) on linkage over 3 observations.
     Z = np.asarray([[0, 1, 3.0, 2],
                     [3, 2, 4.0, 3]], dtype=np.double)
     assert_equal(num_obs_linkage(Z), 3)
Exemplo n.º 8
0
 def test_num_obs_linkage_1x4(self):
     # Tests num_obs_linkage(Z) on linkage over 2 observations.
     Z = np.asarray([[0, 1, 3.0, 2]], dtype=np.double)
     assert_equal(num_obs_linkage(Z), 2)