-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
error in error message in compute_class_weight #8312
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
Comments
PR welcome
…On 8 Feb 2017 7:51 am, "MMeketon" ***@***.***> wrote:
In the file *class_weight.py*, in the function *compute_class_weight*, is
the piece of code:
for c in class_weight:
i = np.searchsorted(classes, c)
if i >= len(classes) or classes[i] != c:
raise ValueError("Class label %d not present." % c)
else:
weight[i] = class_weight[c]
The line "Class label %d not present." % c fails if the class label is a
string, not an integer.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#8312>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAEz6y5um9vc0gZs4CYTHARKIJos3S64ks5raNlugaJpZM4L6BJK>
.
|
Sure. The {} fix is what I did in my private code. I’ll process this later this morning.
From: Shubham Bhardwaj [mailto:[email protected]]
Sent: Wednesday, February 08, 2017 2:08 AM
To: scikit-learn/scikit-learn
Cc: Meketon, Marc; Author
Subject: Re: [scikit-learn/scikit-learn] error in error message in compute_class_weight (#8312)
Just use %s instead of %d or use { } instead of %d and do a .format(c)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#8312 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMpYDxnk7ty6QxQawCA6yL65MxjfJnOUks5raWnEgaJpZM4L6BJK>.
…________________________________
This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail. Thank you for your cooperation.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the file class_weight.py, in the function compute_class_weight, is the piece of code:
The line
"Class label %d not present." % c
fails if the class label is a string, not an integer.The text was updated successfully, but these errors were encountered: