8000 Fixes issue #7751 by visheshmistry · Pull Request #7807 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

Fixes issue #7751 #7807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sklearn/metrics/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,17 @@ class 2 1.00 0.67 0.80 3

last_line_heading = 'avg / total'

# fixes bug 7751
# check if length of target names is same as that of labels
# if not, give the user a warning
if target_names is None:
target_names = ['%s' % l for l in labels]
else:
if(len(target_names) != len(labels)):
raise ValueError('labels has '+str(len(labels)) +
' elements while target_names has ' +
str(len(target_names)) + ' elements.')

name_width = max(len(cn) for cn in target_names)
width = max(name_width, len(last_line_heading), digits)

Expand Down
0