Skip to content

Commit

Permalink
refactor: Change unsupported to unknown (#1229)
Browse files Browse the repository at this point in the history
fixes #1135
  • Loading branch information
MarieS-WiMLDS authored Jan 27, 2025
1 parent c976c4b commit 85de5a6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions skore/src/skore/sklearn/find_ml_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _find_ml_task(y, estimator=None) -> MLTask:
return "multiclass-classification"
else: # fallback on the target
if y is None:
return "unsupported"
return "unknown"

target_type = type_of_target(y)
if target_type == "binary":
Expand All @@ -84,8 +84,8 @@ def _find_ml_task(y, estimator=None) -> MLTask:
if _is_sequential(y) and 0 in y:
return "multiclass-classification"
return "regression"
return "unsupported"
return "unsupported"
return "unknown"
return "unknown"
else:
if y is None:
# NOTE: The task might not be clustering
Expand All @@ -104,4 +104,4 @@ def _find_ml_task(y, estimator=None) -> MLTask:
if _is_sequential(y) and 0 in y:
return "multiclass-classification"
return "regression"
return "unsupported"
return "unknown"
2 changes: 1 addition & 1 deletion skore/src/skore/sklearn/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"multiclass-classification",
"regression",
"clustering",
"unsupported",
"unknown",
]
6 changes: 3 additions & 3 deletions skore/tests/unit/sklearn/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
(
*make_multilabel_classification(random_state=42),
MultiOutputClassifier(LogisticRegression()),
"unsupported",
"unknown",
),
],
)
Expand All @@ -53,7 +53,7 @@ def test_find_ml_task_with_estimator(X, y, estimator, expected_task, should_fit)
),
(make_regression(n_samples=100, random_state=42)[1], "regression"),
(None, "clustering"),
(make_multilabel_classification(random_state=42)[1], "unsupported"),
(make_multilabel_classification(random_state=42)[1], "unknown"),
(numpy.array([1, 5, 9]), "regression"),
(numpy.array([0, 1, 2]), "multiclass-classification"),
(numpy.array([1, 2, 3]), "regression"),
Expand All @@ -68,4 +68,4 @@ def test_find_ml_task_unfitted_estimator():
from sklearn.dummy import DummyClassifier

estimator = DummyClassifier()
assert _find_ml_task(None, estimator) == "unsupported"
assert _find_ml_task(None, estimator) == "unknown"
2 changes: 1 addition & 1 deletion skore/tests/unit/utils/test_accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def func(self):


def test_check_supported_ml_task():
"""Test that ML task validation accepts supported tasks and rejects unsupported
"""Test that ML task validation accepts supported tasks and rejects unknown
ones.
"""

Expand Down

0 comments on commit 85de5a6

Please sign in to comment.