Skip to content

Commit afe1b60

Browse files
committed
ADD: wrapper for get_true_label_position
1 parent 0fd0fbc commit afe1b60

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from sklearn.utils import deprecated
2+
3+
from mapie.conformity_scores.sets.utils import (
4+
get_true_label_position as get_true_label_position_new_path,
5+
)
6+
7+
8+
@deprecated(
9+
"WARNING: Deprecated path to import get_true_label_position. "
10+
"Please prefer the new path: "
11+
"[from mapie.conformity_scores.sets.utils import get_true_label_position]."
12+
)
13+
def get_true_label_position(*args, **kwargs):
14+
return get_true_label_position_new_path(*args, **kwargs)

mapie/tests/test_common.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,15 @@ def get_estimation_distribution(
268268
return np.add(y_pred, conformity_scores) + 1
269269

270270
DummyConformityScore()
271+
272+
273+
def test_warning_when_import_from_old_get_true_label_position():
274+
"""Check that a DepreciationWarning is raised when importing from
275+
mapie.conformity_scores.residual_conformity_scores"""
276+
277+
with pytest.warns(
278+
FutureWarning, match=r".*WARNING: Deprecated path to import.*"
279+
):
280+
from mapie.conformity_scores.utils_classification_conformity_scores\
281+
import get_true_label_position
282+
get_true_label_position(np.array([[0.1, 0.2, 0.7]]), np.array([2]))

0 commit comments

Comments
 (0)