diff options
author | Manu <msoriano4@us.es> | 2022-02-23 19:27:36 +0100 |
---|---|---|
committer | Manu <msoriano4@us.es> | 2022-02-23 19:27:36 +0100 |
commit | a1e8821384c58f7d843a3271f909c31c26649032 (patch) | |
tree | 2c11c4069382ae138576d0dcaa023d8bdd9551d7 /src | |
parent | 758111506dfb99cdc59981395386926e178d447c (diff) |
Revert "a test for gudhi.representations.Entropy has been added"
This reverts commit 758111506dfb99cdc59981395386926e178d447c.
Diffstat (limited to 'src')
-rw-r--r-- | src/python/gudhi/representations/vector_methods.py | 2 | ||||
-rwxr-xr-x | src/python/test/test_representations.py | 12 |
2 files changed, 2 insertions, 12 deletions
diff --git a/src/python/gudhi/representations/vector_methods.py b/src/python/gudhi/representations/vector_methods.py index ef1329d0..57ca5999 100644 --- a/src/python/gudhi/representations/vector_methods.py +++ b/src/python/gudhi/representations/vector_methods.py @@ -532,7 +532,7 @@ class Entropy(BaseEstimator, TransformerMixin): for k in range(min_idx, max_idx): ent[k] += (-1) * p[j] * np.log(p[j]) if self.normalized: - ent = ent / (np.linalg.norm(ent, ord=1)) + ent = ent / np.linalg.norm(ent, ord=1) Xfit.append(np.reshape(ent,[1,-1])) Xfit = np.concatenate(Xfit, axis=0) diff --git a/src/python/test/test_representations.py b/src/python/test/test_representations.py index 553ceba0..6a3dddc4 100755 --- a/src/python/test/test_representations.py +++ b/src/python/test/test_representations.py @@ -160,17 +160,7 @@ def test_entropy_miscalculation(): l = l/sum(l) return -np.dot(l, np.log(l)) sce = Entropy(mode="scalar") - assert [[pe(diag_ex)]] == sce.fit_transform([diag_ex]) - sce = Entropy(mode="vector", resolution=4, normalized=False) - pef = [-1/4*np.log(1/4)-1/4*np.log(1/4)-1/2*np.log(1/2), - -1/4*np.log(1/4)-1/4*np.log(1/4)-1/2*np.log(1/2), - -1/2*np.log(1/2), - 0.0] - assert all(([pef] == sce.fit_transform([diag_ex]))[0]) - sce = Entropy(mode="vector", resolution=4, normalized=True) - pefN = (sce.fit_transform([diag_ex]))[0] - area = np.linalg.norm(pefN, ord=1) - assert area==1 + assert [[pe_max(diag_ex)]] == sce.fit_transform([diag_ex]) def test_kernel_empty_diagrams(): empty_diag = np.empty(shape = [0, 2]) |