Skip to content

Commit 89f55a3

Browse files
Remove enbpi warning (#570)
ENH: remove optimize_beta warning in back-end (optimize_beta has been introduced only for ENBPI in the scientific literature, but it works for all regression methods, so we can support it)
1 parent 4242e83 commit 89f55a3

File tree

3 files changed

+1
-21
lines changed

3 files changed

+1
-21
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ History
1414
* Fix issue 547 to fix wrong warning
1515
* Fix issue 480 (correct display of mathematical equations in generated notebooks)
1616
* Refactor MapieRegressor, EnsembleRegressor, and MapieQuantileRegressor, to prepare for the release of v1.0.0
17+
* Remove optimize_beta usage warning when using for methods other than EnbPI
1718

1819
0.9.1 (2024-09-13)
1920
------------------

mapie/regression/regression.py

Lines changed: 0 additions & 8 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 Any, Iterable, Optional, Tuple, Union, cast
54

65
import numpy as np
@@ -694,13 +693,6 @@ def predict(
694693
return np.array(y_pred)
695694

696695
else:
697-
if optimize_beta and self.method != 'enbpi':
698-
warnings.warn(
699-
"WARNING: Beta optimisation should only be used for "
700-
"method='enbpi'.",
701-
UserWarning
702-
)
703-
704696
# Check alpha and the number of effective calibration samples
705697
alpha_np = cast(NDArray, alpha)
706698
if not allow_infinite_bounds:

mapie/tests/test_regression.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -864,19 +864,6 @@ def test_return_multi_pred(ensemble: bool) -> None:
864864
assert len(output) == 3
865865

866866

867-
def test_beta_optimize_user_warning() -> None:
868-
"""
869-
Test that a UserWarning is displayed when optimize_beta is used.
870-
"""
871-
mapie_reg = MapieRegressor(
872-
conformity_score=AbsoluteConformityScore(sym=False)
873-
).fit(X, y)
874-
with pytest.warns(
875-
UserWarning, match=r"Beta optimisation should only be used for*",
876-
):
877-
mapie_reg.predict(X, alpha=0.05, optimize_beta=True)
878-
879-
880867
def test_fit_parameters_passing() -> None:
881868
"""
882869
Test passing fit parameters, here early stopping at iteration 3.

0 commit comments

Comments
 (0)