Skip to content

Commit

Permalink
tst: Modified SSR test to find a sparse model
Browse files Browse the repository at this point in the history
Previously, SSR has simply been finding the 0-sparsity model.  Instead of the
algorithm in the paper, it was executing a Bayes Information Criterion-like
model selection, but with a very low l0 penalty.

This test asserts #532
  • Loading branch information
Jacob-Stevens-Haas committed Oct 16, 2024
1 parent a4a7729 commit 31f909b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/test_optimizers/test_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,8 @@ def test_ssr_history():
x[:, 0] = y
x += np.random.normal(size=(10, 3), scale=1e-2)
opt = SSR()
opt.fit(x, y).coef_
result = opt.fit(x, y).coef_
expected = np.array([[1, 0, 0]])

assert len(opt.history_) == len(opt.err_history_)
np.testing.assert_allclose(result, expected)

0 comments on commit 31f909b

Please sign in to comment.