Пример #1
0
 def test_diagonal_empty_codes(self):
     importance_matrix = np.array([[
         1.,
         0.,
     ], [0., 1.], [0., 0.]])
     result = dci.disentanglement(importance_matrix)
     np.testing.assert_allclose(result, 1.0)
Пример #2
0
 def test_one_code_two_factors(self):
     importance_matrix = np.diag(5. * np.ones(5))
     importance_matrix = np.hstack([importance_matrix, importance_matrix])
     result = dci.disentanglement(importance_matrix)
     np.testing.assert_allclose(result, 1. - np.log(2) / np.log(10))
Пример #3
0
 def test_missed_factors(self):
     importance_matrix = np.diag(5. * np.ones(5))
     result = dci.disentanglement(importance_matrix[:2, :])
     np.testing.assert_allclose(result, 1.0)
Пример #4
0
 def test_redundant_codes(self):
     importance_matrix = np.diag(5. * np.ones(5))
     importance_matrix = np.vstack([importance_matrix, importance_matrix])
     result = dci.disentanglement(importance_matrix)
     np.testing.assert_allclose(result, 1.)
Пример #5
0
 def test_zero(self):
     importance_matrix = np.zeros(shape=[10, 10], dtype=np.float64)
     result = dci.disentanglement(importance_matrix)
     np.testing.assert_allclose(result, .0)
Пример #6
0
 def test_diagonal(self):
     importance_matrix = np.diag(5. * np.ones(5))
     result = dci.disentanglement(importance_matrix)
     np.testing.assert_allclose(result, 1.0)