We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1ce772 commit 8117795Copy full SHA for 8117795
tests/test_feature_simple_cur.py
@@ -46,6 +46,22 @@ def test_non_it(self):
46
47
self.assertTrue(np.allclose(selector.selected_idx_, ref_idx))
48
49
+ def test_unique_selected_idx_zero_score(self):
50
+ """
51
+ Tests that the selected idxs are unique, which may not be the
52
+ case when the score is numerically zero
53
54
+ np.random.seed(0)
55
+ n_samples = 10
56
+ n_features = 15
57
+ X = np.random.rand(n_samples, n_features)
58
+ X[:, 3] = np.random.rand(10) * 1e-13
59
+ X[:, 4] = np.random.rand(10) * 1e-13
60
+ selector_problem = CUR(n_to_select=len(X.T)).fit(X)
61
+ assert len(selector_problem.selected_idx_) == len(
62
+ set(selector_problem.selected_idx_)
63
+ )
64
+
65
66
if __name__ == "__main__":
67
unittest.main(verbosity=2)
0 commit comments