diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2020-04-22 19:46:29 +0200 |
---|---|---|
committer | Marc Glisse <marc.glisse@inria.fr> | 2020-04-22 19:46:29 +0200 |
commit | c5db8c1aec523c0cdf72c75b29e4ba94b51487b8 (patch) | |
tree | 2f18a789646ffab4b3b7189b493de2637f317a88 /src/python/test | |
parent | f218c8a94d3a383bad862dfcc2b92196ef245628 (diff) |
Reduce the probability of failure of test_dtm
It is expected that hnsw sometimes misses one neighbor, which has an
impact on the DTM, especially if the number of neighbors considered is
low.
Diffstat (limited to 'src/python/test')
-rwxr-xr-x | src/python/test/test_dtm.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/python/test/test_dtm.py b/src/python/test/test_dtm.py index 859189fa..bff4c267 100755 --- a/src/python/test/test_dtm.py +++ b/src/python/test/test_dtm.py @@ -16,7 +16,7 @@ import torch def test_dtm_compare_euclidean(): pts = numpy.random.rand(1000, 4) - k = 3 + k = 6 dtm = DistanceToMeasure(k, implementation="ckdtree") r0 = dtm.fit_transform(pts) dtm = DistanceToMeasure(k, implementation="sklearn") @@ -27,7 +27,7 @@ def test_dtm_compare_euclidean(): assert r2 == pytest.approx(r0) dtm = DistanceToMeasure(k, implementation="hnsw") r3 = dtm.fit_transform(pts) - assert r3 == pytest.approx(r0) + assert r3 == pytest.approx(r0, rel=0.1) from scipy.spatial.distance import cdist d = cdist(pts, pts) |