Skip to content

Commit abfc309

Browse files
ENH: MapieQuantileRegressor - remove warning about alpha and correct docstring (#585)
1 parent 364df9a commit abfc309

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

mapie/regression/quantile_regression.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import warnings
43
from typing import Iterable, List, Optional, Tuple, Union, cast, Any
54

65
import numpy as np
@@ -26,8 +25,6 @@ class MapieQuantileRegressor(MapieRegressor):
2625
"""
2726
This class implements the conformalized quantile regression strategy
2827
as proposed by Romano et al. (2019) to make conformal predictions.
29-
The only valid ``method`` is ``"quantile"`` and the only valid
30-
``cv`` is ``"split"``.
3128
3229
Parameters
3330
----------
@@ -197,12 +194,6 @@ def _check_alpha(
197194
ValueError
198195
If the value of ``alpha`` is not between ``0.0`` and ``1.0``.
199196
"""
200-
if self.cv == "prefit":
201-
warnings.warn(
202-
"WARNING: The alpha that is set needs to be the same"
203-
+ " as the alpha of your prefitted model in the following"
204-
" order [alpha/2, 1 - alpha/2, 0.5]"
205-
)
206197
if isinstance(alpha, float):
207198
if np.any(np.logical_or(alpha <= 0, alpha >= 1.0)):
208199
raise ValueError(

mapie/tests/test_quantile_regression.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -589,30 +589,6 @@ def test_non_trained_estimator() -> None:
589589
)
590590

591591

592-
def test_warning_alpha_prefit() -> None:
593-
"""
594-
Check that the user is warned that the alphas need to be correctly set.
595-
"""
596-
with pytest.warns(
597-
UserWarning,
598-
match=r".*WARNING: The alpha that is set needs to be the same*"
599-
):
600-
gb_trained1, gb_trained2, gb_trained3 = clone(gb), clone(gb), clone(gb)
601-
gb_trained1.fit(X_train, y_train)
602-
gb_trained2.fit(X_train, y_train)
603-
gb_trained3.fit(X_train, y_train)
604-
list_estimators = [gb_trained1, gb_trained2, gb_trained3]
605-
mapie_reg = MapieQuantileRegressor(
606-
estimator=list_estimators,
607-
cv="prefit",
608-
alpha=0.3
609-
)
610-
mapie_reg.fit(
611-
X_calib,
612-
y_calib
613-
)
614-
615-
616592
@pytest.mark.parametrize("alpha", [0.05, 0.1, 0.2, 0.3])
617593
def test_prefit_and_non_prefit_equal(alpha: float) -> None:
618594
"""

0 commit comments

Comments
 (0)