Skip to content

Commit

Permalink
FIX tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Damien-Bouet committed Jul 31, 2024
1 parent 66fe957 commit 3c0f1c7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions mapie/tests/test_futur_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
GaussianCCP(5),
]
WIDTHS = {
"split": 3.87,
"prefit": 3.89,
"split": 3.943,
"prefit": 3.943,
}

COVERAGES = {
Expand Down Expand Up @@ -587,8 +587,8 @@ def test_results_prefit() -> None:
y_pred_low, y_pred_up = y_pis[:, 0, 0], y_pis[:, 1, 0]
width_mean = (y_pred_up - y_pred_low).mean()
coverage = regression_coverage_score(y, y_pred_low, y_pred_up)
np.testing.assert_allclose(width_mean, WIDTHS["split"], rtol=1e-2)
np.testing.assert_allclose(coverage, COVERAGES["split"], rtol=1e-2)
np.testing.assert_allclose(width_mean, WIDTHS["prefit"], rtol=1e-2)
np.testing.assert_allclose(coverage, COVERAGES["prefit"], rtol=1e-2)


@pytest.mark.parametrize("calibrator", PHI)
Expand Down Expand Up @@ -679,3 +679,11 @@ def test_check_conformity_scores_error() -> None:
mapie = SplitCPRegressor()
with pytest.raises(ValueError, match="Invalid conformity scores."):
mapie._check_conformity_scores(np.random.rand(200, 5))


def test_optim_kwargs():
mapie = SplitCPRegressor(alpha=0.1)
with pytest.warns(UserWarning, match="Iteration limit reached"):
mapie.fit(
X, y, calib_kwargs={"options": {"method": "SFSQP", "maxiter": 2}}
)

0 comments on commit 3c0f1c7

Please sign in to comment.