10000 API drop Tags.regressor_tags.multi_label (#30373) · scikit-learn/scikit-learn@0ad96c3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0ad96c3

Browse files
ogriseljeremiedbb
authored andcommitted
API drop Tags.regressor_tags.multi_label (#30373)
1 parent b6281e3 commit 0ad96c3

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

sklearn/ensemble/_forest.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,11 +1165,6 @@ def _compute_partial_dependence_recursion(self, grid, target_features):
11651165

11661166
return averaged_predictions
11671167

1168-
def __sklearn_tags__(self):
1169-
tags = super().__sklearn_tags__()
1170-
tags.regressor_tags.multi_label = True
1171-
return tags
1172-
11731168

11741169
class RandomForestClassifier(ForestClassifier):
11751170
"""

sklearn/utils/_tags.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ class TargetTags:
9898
Whether a regressor supports multi-target outputs or a classifier supports
9999
multi-class multi-output.
100100
101+
See :term:`multi-output` in the glossary.
102+
101103
single_output : bool, default=True
102104
Whether the target can be single-output. This can be ``False`` if the
103105
estimator supports only multi-output cases.
@@ -150,8 +152,13 @@ class ClassifierTags:
150152
classification. Therefore this flag indicates whether the
151153
classifier is a binary-classifier-only or not.
152154
155+
See :term:`multi-class` in the glossary.
156+
153157
multi_label : bool, default=False
154-
Whether the classifier supports multi-label output.
158+
Whether the classifier supports multi-label output: a data point can
159+
be predicted to belong to a variable number of classes.
160+
161+
See :term:`multi-label` in the glossary.
155162
"""
156163

157164
poor_score: bool = False
@@ -172,13 +179,9 @@ class RegressorTags:
172179
n_informative=1, bias=5.0, noise=20, random_state=42)``. The
173180
dataset and values are based on current estimators in scikit-learn
174181
and might be replaced by something more systematic.
175-
176-
multi_label : bool, default=False
177-
Whether the regressor supports multilabel output.
178182
"""
179183

180184
poor_score: bool = False
181-
multi_label: bool = False
182185

183186

184187
@dataclass(**_dataclass_args())
@@ -496,7 +499,6 @@ def _to_new_tags(old_tags, estimator=None):
496499
if estimator_type == "regressor":
497500
regressor_tags = RegressorTags(
498501
poor_score=old_tags["poor_score"],
499-
multi_label=old_tags["multilabel"],
500502
)
501503
else:
502504
regressor_tags = None
@@ -520,18 +522,16 @@ def _to_old_tags(new_tags):
520522
"""Utility function convert old tags (dictionary) to new tags (dataclass)."""
521523
if new_tags.classifier_tags:
522524
binary_only = not new_tags.classifier_tags.multi_class
523-
multilabel_clf = new_tags.classifier_tags.multi_label
525+
multilabel = new_tags.classifier_tags.multi_label
524526
poor_score_clf = new_tags.classifier_tags.poor_score
525527
else:
526528
binary_only = False
527-
multilabel_clf = False
529+
multilabel = False
528530
poor_score_clf = False
529531

530532
if new_tags.regressor_tags:
531-
multilabel_reg = new_tags.regressor_tags.multi_label
532533
poor_score_reg = new_tags.regressor_tags.poor_score
533534
else:
534-
multilabel_reg = False
535535
poor_score_reg = False
536536

537537
if new_tags.transformer_tags:
@@ -543,7 +543,7 @@ def _to_old_tags(new_tags):
543543
"allow_nan": new_tags.input_tags.allow_nan,
544544
"array_api_support": new_tags.array_api_support,
545545
"binary_only": binary_only,
546-
"multilabel": multilabel_clf or multilabel_reg,
546+
"multilabel": multilabel,
547547
"multioutput": new_tags.target_tags.multi_output,
548548
"multioutput_only": (
549549
not new_tags.target_tags.single_output and new_tags.target_tags.multi_output

sklearn/utils/estimator_checks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4438,7 +4438,6 @@ def check_valid_tag_types(name, estimator):
44384438

44394439
if tags.regressor_tags is not None:
44404440
assert isinstance(tags.regressor_tags.poor_score, bool), err_msg
4441-
assert isinstance(tags.regressor_tags.multi_label, bool), err_msg
44424441

44434442
if tags.transformer_tags is not None:
44444443
assert isinstance(tags.transformer_tags.preserves_dtype, list), err_msg

sklearn/utils/tests/test_tags.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ def __sklearn_tags__(self):
434434
classifier_tags = None
435435
regressor_tags = RegressorTags(
436436
poor_score=True,
437-
multi_label=True,
438437
)
439438
return Tags(
440439
estimator_type=self._estimator_type,
@@ -452,7 +451,7 @@ def __sklearn_tags__(self):
452451
"allow_nan": True,
453452
"array_api_support": False,
454453
"binary_only": False,
455-
"multilabel": True,
454+
"multilabel": False,
456455
"multioutput": True,
457456
"multioutput_only": True,
458457
"no_validation": False,

0 commit comments

Comments
 (0)
0