Пример #1
0
 def test_mlab_linkage_conversion_multiple_rows(self):
     # Tests from/to_mlab_linkage on linkage array with multiple rows.
     Zm = np.asarray([[3, 6, 138], [4, 5, 219], [1, 8, 255], [2, 9, 268],
                      [7, 10, 295]])
     Z = np.array(
         [[2., 5., 138., 2.], [3., 4., 219., 2.], [0., 7., 255., 3.],
          [1., 8., 268., 4.], [6., 9., 295., 6.]],
         dtype=np.double)
     assert_equal(from_mlab_linkage(Zm), Z)
     assert_equal(to_mlab_linkage(Z), Zm)
Пример #2
0
 def test_mlab_linkage_conversion_multiple_rows(self):
     # Tests from/to_mlab_linkage on linkage array with multiple rows.
     Zm = np.asarray([[3, 6, 138], [4, 5, 219],
                      [1, 8, 255], [2, 9, 268], [7, 10, 295]])
     Z = np.array([[2., 5., 138., 2.],
                   [3., 4., 219., 2.],
                   [0., 7., 255., 3.],
                   [1., 8., 268., 4.],
                   [6., 9., 295., 6.]],
                   dtype=np.double)
     assert_equal(from_mlab_linkage(Zm), Z)
     assert_equal(to_mlab_linkage(Z), Zm)
Пример #3
0
 def test_mlab_linkage_conversion_single_row(self):
     # Tests from/to_mlab_linkage on linkage array with single row.
     Z = np.asarray([[0., 1., 3., 2.]])
     Zm = [[1, 2, 3]]
     assert_equal(from_mlab_linkage(Zm), Z)
     assert_equal(to_mlab_linkage(Z), Zm)
Пример #4
0
 def test_mlab_linkage_conversion_empty(self):
     # Tests from/to_mlab_linkage on empty linkage array.
     X = np.asarray([])
     assert_equal(from_mlab_linkage([]), X)
     assert_equal(to_mlab_linkage([]), X)
Пример #5
0
 def test_mlab_linkage_conversion_single_row(self):
     # Tests from/to_mlab_linkage on linkage array with single row.
     Z = np.asarray([[0., 1., 3., 2.]])
     Zm = [[1, 2, 3]]
     assert_equal(from_mlab_linkage(Zm), Z)
     assert_equal(to_mlab_linkage(Z), Zm)
Пример #6
0
 def test_mlab_linkage_conversion_empty(self):
     # Tests from/to_mlab_linkage on empty linkage array.
     X = np.asarray([])
     assert_equal(from_mlab_linkage([]), X)
     assert_equal(to_mlab_linkage([]), X)