File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Specific tests for the dimensionality_reduction task"""
22import openproblems
3+ import parameterized
34import utils .docker
45import utils .git
56
@@ -54,6 +55,26 @@ def test_density_preservation_matches_densmap():
5455 np .testing .assert_allclose (expected , actual , rtol = 1e-3 )
5556
5657
58+ @parameterized .parameterized .expand (
59+ [(200 ,), (1000 ,)],
60+ name_func = utils .name .name_test ,
61+ )
62+ def test_distance_correlation_with_svd (n_svd ):
63+ import numpy as np
64+
65+ task = openproblems .tasks .dimensionality_reduction
66+ metric = openproblems .tasks .dimensionality_reduction .metrics .distance_correlation
67+
68+ adata = task .api .sample_dataset ()
69+ adata = task .api .sample_method (adata )
70+ adata .obsm ["X_emb" ] = adata .X .toarray ()
71+
72+ expected = 1
73+ actual = metric (adata , n_svd = n_svd )
74+
75+ np .testing .assert_allclose (expected , actual , rtol = 1e-3 )
76+
77+
5778def test_density_preservation_perfect ():
5879 import numpy as np
5980
You can’t perform that action at this time.
0 commit comments