-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG] FIX top_k_accuracy_score ignoring labels for "multiclass" case #19721
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
Conversation
Would love to see this one merge, anything needed to make sure it crosses the finish line? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this @flyingdutchman23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Do you need help resolving the merge conflict? I'm interested in making sure this lands before the next release :). |
Thank you for pointing that out, Done. I further improved a commit description and included a fixup commit in another commit to have a cleaner history. |
I guess this bugfix is not slated to land in the pending release? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. @glemaitre should it go in 0.24.2 as a fix to a new feature??
We can add it in the upcoming release. You only need to move the entry in |
Currently the last 2 parameters of the added test fail, because the labels are not considered to decide whether the target is "binary" or "multiclass". The labels parameters is only used in later steps.
If a problem is actually "multiclass", and not all classes are contained in the parameter `y_true` , the function fails, because the determined type is "binary". That decision makes sense, if the parameter labels is not passed. The problem is that the function also fails, if the parameter `labels` is passed, although it would be possible to determine the type of and the number of classes in conjunction with this parameter. This commit fixes that, by checking whether the `labels` parameter has been set and contains more than 2 classes, if the type has been determined to be "binary" in the previous step.
This is for the case where `labels` is an `ndarray`. Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
@glemaitre thanks for reviewing. The changelog has been moved to |
Thanks |
Reference Issues/PRs
Same changes as #19300, which I accidentally closed, but can not reopen.
What does this implement/fix? Explain your changes.
See #19300 for these changes and review by @thomasjpfan. If wanted, I can copy that content here.
Any other comments?
I'm sorry for this extra work/confusion.