summaryrefslogtreecommitdiff
path: root/src/python/test
diff options
context:
space:
mode:
authorVincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com>2020-07-23 15:38:29 +0200
committerGitHub <noreply@github.com>2020-07-23 15:38:29 +0200
commit7bd8c85deb864166c228cea8ea2edfba32cced24 (patch)
treed1aaa95f4135661347162bb147dd89583775b4d7 /src/python/test
parent444ec77fe16783c35ef86598011a662c5d6e8d92 (diff)
parent96eb09e4f034fd71f5674f75e5e4584a7402b218 (diff)
Merge pull request #348 from martinroyer/atol
Introduction of ATOL in finite vectorisation method
Diffstat (limited to 'src/python/test')
-rwxr-xr-xsrc/python/test/test_representations.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/python/test/test_representations.py b/src/python/test/test_representations.py
index 589cee00..e5c211a0 100755
--- a/src/python/test/test_representations.py
+++ b/src/python/test/test_representations.py
@@ -4,6 +4,8 @@ import matplotlib.pyplot as plt
import numpy as np
import pytest
+from sklearn.cluster import KMeans
+
def test_representations_examples():
# Disable graphics for testing purposes
@@ -15,6 +17,7 @@ def test_representations_examples():
return None
+from gudhi.representations.vector_methods import Atol
from gudhi.representations.metrics import *
from gudhi.representations.kernel_methods import *
@@ -41,3 +44,17 @@ def test_multiple():
d2 = WassersteinDistance(order=2, internal_p=2, n_jobs=4).fit(l2).transform(l1)
print(d1.shape, d2.shape)
assert d1 == pytest.approx(d2, rel=.02)
+
+
+def test_dummy_atol():
+ a = np.array([[1, 2, 4], [1, 4, 0], [1, 0, 4]])
+ b = np.array([[4, 2, 0], [4, 4, 0], [4, 0, 2]])
+ c = np.array([[3, 2, -1], [1, 2, -1]])
+
+ for weighting_method in ["cloud", "iidproba"]:
+ for contrast in ["gaussian", "laplacian", "indicator"]:
+ atol_vectoriser = Atol(quantiser=KMeans(n_clusters=1, random_state=202006), weighting_method=weighting_method, contrast=contrast)
+ atol_vectoriser.fit([a, b, c])
+ atol_vectoriser(a)
+ atol_vectoriser.transform(X=[a, b, c])
+