Skip to content

TST adapt tol for ridge tests to pass on all random seeds #23017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sklearn/linear_model/tests/test_ridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def test_ridge_regression_vstacked_X(
alpha=2 * alpha,
fit_intercept=fit_intercept,
solver=solver,
tol=1e-11,
tol=1e-15 if solver in ("sag", "saga") else 1e-10,
random_state=global_random_seed,
)
X = X[:, :-1] # remove intercept
Expand Down Expand Up @@ -1663,7 +1663,7 @@ def test_ridge_fit_intercept_sparse(solver, with_sample_weight, global_random_se
sparse_ridge.fit(sp.csr_matrix(X), y, sample_weight=sample_weight)

assert_allclose(dense_ridge.intercept_, sparse_ridge.intercept_)
assert_allclose(dense_ridge.coef_, sparse_ridge.coef_)
assert_allclose(dense_ridge.coef_, sparse_ridge.coef_, rtol=5e-7)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change required for test_ridge_fit_intercept_sparse to locally pass for you?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, to pass for all random seeds.



@pytest.mark.parametrize("solver", ["saga", "svd", "cholesky"])
Expand Down