From 578e5c18f25039682d637b79d4797ea5477f607e Mon Sep 17 00:00:00 2001 From: adamgayoso Date: Thu, 28 Dec 2023 04:35:52 +0000 Subject: [PATCH] fix test --- tests/test_metrics.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_metrics.py b/tests/test_metrics.py index a46da0a..d5bfa54 100644 --- a/tests/test_metrics.py +++ b/tests/test_metrics.py @@ -73,7 +73,10 @@ def test_lisi_knn(): harmonypy_lisi_res = harmonypy_lisi( X, pd.DataFrame(labels, columns=["labels"]), label_colnames=["labels"], perplexity=10 )[:, 0] - np.testing.assert_allclose(lisi_res, harmonypy_lisi_res) + # Slight numerical differences arise due to how self edges are handled. With approximate nearest + # neighbors methods, there is no guarantee that the self edge is the first edge. To accomodate this, + # we mask out self edges internally in lisi computation which causes slight numerical differences. + np.testing.assert_allclose(lisi_res, harmonypy_lisi_res, rtol=5e-5, atol=5e-5) def test_ilisi_clisi_knn():