diff options
author | Manu <msoriano4@us.es> | 2022-02-14 13:58:01 +0100 |
---|---|---|
committer | Manu <msoriano4@us.es> | 2022-02-14 13:58:01 +0100 |
commit | 3b7bd4fd8b21fc8ce0d7b2848b5ac9bdd397c080 (patch) | |
tree | 2c11c4069382ae138576d0dcaa023d8bdd9551d7 /src/python/test/test_representations.py | |
parent | 2a2aae065bf34cfcf8bba52695ce3ae3ca6d4048 (diff) |
A bug in the Entropy function has been solved
Diffstat (limited to 'src/python/test/test_representations.py')
-rwxr-xr-x | src/python/test/test_representations.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/python/test/test_representations.py b/src/python/test/test_representations.py index d219ce7a..6a3dddc4 100755 --- a/src/python/test/test_representations.py +++ b/src/python/test/test_representations.py @@ -152,7 +152,16 @@ def test_vectorization_empty_diagrams(): scv = Entropy(mode="vector", normalized=False, resolution=random_resolution)(empty_diag) assert not np.any(scv) assert scv.shape[0] == random_resolution - + +def test_entropy_miscalculation(): + diag_ex = np.array([[0.0,1.0], [0.0,1.0], [0.0,2.0]]) + def pe(pd): + l = pd[:,1] - pd[:,0] + l = l/sum(l) + return -np.dot(l, np.log(l)) + sce = Entropy(mode="scalar") + assert [[pe_max(diag_ex)]] == sce.fit_transform([diag_ex]) + def test_kernel_empty_diagrams(): empty_diag = np.empty(shape = [0, 2]) assert SlicedWassersteinDistance(num_directions=100)(empty_diag, empty_diag) == 0. |