Пример #1
0
 def test_partition_02(self):
     np.random.seed(42)
     matrix = np.random.uniform(-1, 1, 9).reshape(3, 3)
     ss = Subspaces(dim=2)
     ss.evects = matrix
     ss._partition()
     np.testing.assert_array_almost_equal(matrix[:, 2:], ss.W2)
Пример #2
0
 def test_partition_05(self):
     np.random.seed(42)
     matrix = np.random.uniform(-1, 1, 9).reshape(3, 3)
     ss = Subspaces(dim=4)
     ss.evects = matrix
     with self.assertRaises(ValueError):
         ss._partition()
Пример #3
0
 def test_partition_03(self):
     np.random.seed(42)
     matrix = np.random.uniform(-1, 1, 9).reshape(3, 3)
     ss = Subspaces()
     ss.evects = matrix
     with self.assertRaises(TypeError):
         ss.partition(dim=2.0)