Ejemplo n.º 1
0
 def test_num_obs_linkage_multi_matrix(self):
     # Tests num_obs_linkage with observation matrices of multiple sizes.
     for n in range(2, 10):
         X = np.random.rand(n, 4)
         Y = pdist(X)
         Z = linkage(Y)
         self.assertTrue(num_obs_linkage(Z) == n)
Ejemplo 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)
         self.assertTrue(num_obs_linkage(Z) == n)
Ejemplo 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 range(4, 15, 3):
         y = np.random.rand(i*(i-1)//2)
         Z = linkage(y)
         self.assertTrue(num_obs_linkage(Z) == i)
Ejemplo 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)
         self.assertTrue(num_obs_linkage(Z) == i)
Ejemplo 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)
     self.assertTrue(num_obs_linkage(Z) == 3)
Ejemplo 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)
     self.assertTrue(num_obs_linkage(Z) == 2)
Ejemplo 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)
     self.assertTrue(num_obs_linkage(Z) == 3)
Ejemplo 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)
     self.assertTrue(num_obs_linkage(Z) == 2)