Skip to content

Commit 0aa8b32

Browse files
committed
ADD: re-add old import path for EnsembleRegressor
1 parent afe1b60 commit 0aa8b32

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

mapie/estimator/estimator.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from sklearn.utils import deprecated
2+
3+
from mapie.estimator.regressor import EnsembleRegressor as NewEnsembleRegressor
4+
5+
6+
@deprecated(
7+
"WARNING: Deprecated path to import EnsembleRegressor. "
8+
"Please prefer the new path: "
9+
"[from mapie.estimator.regressor import EnsembleRegressor]."
10+
)
11+
class EnsembleRegressor(NewEnsembleRegressor):
12+
pass

mapie/tests/test_common.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,23 @@ def test_warning_when_import_from_old_get_true_label_position():
280280
from mapie.conformity_scores.utils_classification_conformity_scores\
281281
import get_true_label_position
282282
get_true_label_position(np.array([[0.1, 0.2, 0.7]]), np.array([2]))
283+
284+
285+
def test_warning_when_import_from_estimator():
286+
"""Check that a DepreciationWarning is raised when importing from
287+
mapie.estimator.estimator"""
288+
289+
with pytest.warns(
290+
FutureWarning, match=r".*WARNING: Deprecated path to import.*"
291+
):
292+
from mapie.estimator.estimator import EnsembleRegressor
293+
EnsembleRegressor(
294+
estimator=LinearRegression(),
295+
method="naive",
296+
cv=3,
297+
agg_function="mean",
298+
n_jobs=1,
299+
random_state=0,
300+
test_size=0.2,
301+
verbose=0,
302+
)

0 commit comments

Comments
 (0)