Skip to content

Commit

Permalink
FIX: add test with non conformity score
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibault Cordier committed May 5, 2023
1 parent 3d6d247 commit 3cbcaf0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mapie/conformity_scores/conformity_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def get_quantile(
``alpha`` is the complement of the target coverage level.
method: str
Method between ``lower'' and ``upper'' to find the quantile
Method between ``lower'' and ``higher'' to find the quantile
in the lower or upper part of the distribution.
Returns
Expand Down
11 changes: 9 additions & 2 deletions mapie/tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ def test_wrong_cv_with_fitted_conformity_score(cv: Any) -> None:
match=r".*Incompatible with cv different of prefit.*",
):
mapie_reg.fit(X, y)
mapie_reg.predict(X, alpha=0.05)


@pytest.mark.parametrize("cv", ["prefit"])
Expand All @@ -616,7 +615,15 @@ def test_wrong_not_fitted_conformity_score(cv: Any) -> None:
match=r".*instance is not fitted yet.*",
):
mapie_reg.fit(X, y)
mapie_reg.predict(X, alpha=0.05)


def test_wrong_conformity_score() -> None:
mapie_reg = MapieRegressor(conformity_score=object())
with pytest.raises(
ValueError,
match=r".*Invalid conformity_score argument.*",
):
mapie_reg.fit(X, y)


@pytest.mark.parametrize("cv", ["prefit"])
Expand Down

0 comments on commit 3cbcaf0

Please sign in to comment.