Beispiel #1
0
 def test_diagonal_empty_codes(self):
     importance_matrix = np.array([[
         1.,
         0.,
     ], [0., 1.], [0., 0.]])
     result = dci.completeness(importance_matrix)
     np.testing.assert_allclose(result, 1.0)
Beispiel #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.completeness(importance_matrix)
     np.testing.assert_allclose(result, 1.)
Beispiel #3
0
 def test_missed_factors(self):
     importance_matrix = np.diag(5. * np.ones(5))
     result = dci.completeness(importance_matrix[:2, :])
     np.testing.assert_allclose(result, 1.0)
Beispiel #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.completeness(importance_matrix)
     np.testing.assert_allclose(result, 1. - np.log(2) / np.log(10))
Beispiel #5
0
 def test_zero(self):
     importance_matrix = np.zeros(shape=[10, 10], dtype=np.float64)
     result = dci.completeness(importance_matrix)
     np.testing.assert_allclose(result, .0, atol=1e-7)
Beispiel #6
0
 def test_diagonal(self):
     importance_matrix = np.diag(5. * np.ones(5))
     result = dci.completeness(importance_matrix)
     np.testing.assert_allclose(result, 1.0)