Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1882672

Browse filesBrowse files
jpangasadrinjalalithomasjpfan
authored
MNT Improve error message when checking classification target is of a non-regression type (#26281)
Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com> Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
1 parent 4af3087 commit 1882672
Copy full SHA for 1882672

File tree

1 file changed

+5
-1
lines changed
Filter options

1 file changed

+5
-1
lines changed

‎sklearn/utils/multiclass.py

Copy file name to clipboardExpand all lines: sklearn/utils/multiclass.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ def check_classification_targets(y):
215215
"multilabel-indicator",
216216
"multilabel-sequences",
217217
]:
218-
raise ValueError("Unknown label type: %r" % y_type)
218+
raise ValueError(
219+
f"Unknown label type: {y_type}. Maybe you are trying to fit a "
220+
"classifier, which expects discrete classes on a "
221+
"regression target with continuous values."
222+
)
219223

220224

221225
def type_of_target(y, input_name=""):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.