Skip to content

Commit d2bc12f

Browse files
committed
Update : Taking into account PR comments
1 parent b2d03b1 commit d2bc12f

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

mapie/tests/test_regression.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -966,8 +966,10 @@ def test_predict_params_expected_behavior_unaffected_by_fit_params() -> None:
966966

967967

968968
def test_using_one_predict_parameter_into_predict_but_not_in_fit() -> None:
969-
"""Test that using predict parameters in the predict method
970-
without using one predict_parameter in the fit method raises an error"""
969+
"""
970+
Test that using predict parameters in the predict method
971+
without using predict_parameter in the fit method raises an error.
972+
"""
971973
custom_gbr = CustomGradientBoostingRegressor(random_state=random_state)
972974
X_train, X_test, y_train, y_test = (
973975
train_test_split(X, y, test_size=0.2, random_state=random_state)
@@ -979,16 +981,18 @@ def test_using_one_predict_parameter_into_predict_but_not_in_fit() -> None:
979981
with pytest.raises(ValueError, match=(
980982
fr".*Using 'predict_param' '{predict_params}' "
981983
r"without using one 'predict_param' in the fit method\..*"
982-
r"Please ensure one 'predict_param' "
983-
r"is used in the fit method before calling predict\..*"
984+
r"Please ensure a similar configuration of 'predict_param' "
985+
r"is used in the fit method before calling it in predict\..*"
984986
)):
985987
mapie_fitted.predict(X_test, **predict_params)
986988

987989

988990
def test_using_one_predict_parameter_into_fit_but_not_in_predict() -> None:
989-
"""Test that using predict parameters in the fit method
990-
without using one predict_parameter in
991-
the predict method raises an error"""
991+
"""
992+
Test that using predict parameters in the fit method
993+
without using predict_parameter in
994+
the predict method raises an error.
995+
"""
992996
custom_gbr = CustomGradientBoostingRegressor(random_state=random_state)
993997
X_train, X_test, y_train, y_test = (
994998
train_test_split(X, y, test_size=0.2, random_state=random_state)
@@ -1000,14 +1004,16 @@ def test_using_one_predict_parameter_into_fit_but_not_in_predict() -> None:
10001004
with pytest.raises(ValueError, match=(
10011005
r"Using one 'predict_param' in the fit method "
10021006
r"without using one 'predict_param' in the predict method. "
1003-
r"Please ensure one 'predict_param' "
1004-
r"is used in the predict method before calling it."
1007+
r"Please ensure a similar configuration of 'predict_param' "
1008+
r"is used in the predict method as called in the fit."
10051009
)):
10061010
mapie_fitted.predict(X_test)
10071011

10081012

10091013
def test_predict_infinite_intervals() -> None:
1010-
"""Test that MapieRegressor produces infinite bounds with alpha=0"""
1014+
"""
1015+
Test that MapieRegressor produces infinite bounds with alpha=0
1016+
"""
10111017
mapie_reg = MapieRegressor().fit(X, y)
10121018
_, y_pis = mapie_reg.predict(X, alpha=0., allow_infinite_bounds=True)
10131019
np.testing.assert_allclose(y_pis[:, 0, 0], -np.inf)
@@ -1017,7 +1023,9 @@ def test_predict_infinite_intervals() -> None:
10171023
@pytest.mark.parametrize("method", ["minmax", "naive", "plus", "base"])
10181024
@pytest.mark.parametrize("cv", ["split", "prefit"])
10191025
def test_check_change_method_to_base(method: str, cv: str) -> None:
1020-
"""Test of the overloading of method attribute to `base` method in fit"""
1026+
"""
1027+
Test of the overloading of method attribute to `base` method in fit
1028+
"""
10211029

10221030
X_train, X_val, y_train, y_val = train_test_split(
10231031
X, y, test_size=0.5, random_state=random_state

mapie/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,13 +1403,13 @@ def check_predict_params(
14031403
raise ValueError(
14041404
f"Using 'predict_param' '{predict_params}' "
14051405
f"without using one 'predict_param' in the fit method. "
1406-
f"Please ensure one 'predict_param' "
1407-
f"is used in the fit method before calling predict."
1406+
f"Please ensure a similar configuration of 'predict_param' "
1407+
f"is used in the fit method before calling it in predict."
14081408
)
14091409
if len(predict_params) == 0 and predict_params_used_in_fit is True:
14101410
raise ValueError(
14111411
"Using one 'predict_param' in the fit method "
14121412
"without using one 'predict_param' in the predict method. "
1413-
"Please ensure one 'predict_param' "
1414-
"is used in the predict method before calling it."
1413+
"Please ensure a similar configuration of 'predict_param' "
1414+
"is used in the predict method as called in the fit."
14151415
)

0 commit comments

Comments
 (0)