TST make test_ridge_regression_hstacked_X more lenient
@@ -217,7 +217,7 @@ def test_ridge_regression_hstacked_X(
alpha=alpha / 2,
fit_intercept=fit_intercept,
solver=solver,
- tol=1e-12,
+ tol=1e-15 if solver in ("sag", "saga") else 1e-10,
random_state=global_random_seed,
)
X = X[:, :-1] # remove intercept
@@ -233,7 +233,9 @@ def test_ridge_regression_hstacked_X(
coef = coef[:-1]
assert model.intercept_ == pytest.approx(intercept)
- assert_allclose(model.coef_, np.r_[coef, coef])
+ # coefficients are not all on the same magnitude, adding a small atol to
+ # make this test less brittle
+ assert_allclose(model.coef_, np.r_[coef, coef], atol=1e-8)
@pytest.mark.parametrize("solver", SOLVERS)
@@ -273,6 +275,8 @@ def test_ridge_regression_vstacked_X(
coef = coef[:-1]
assert model.intercept_ == pytest.approx(intercept)
+ # coefficients are not all on the same magnitude, adding a small atol to
+ # make this test less brittle
assert_allclose(model.coef_, coef, atol=1e-8)
