-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ENH Add Array API compatibility to zero_one_loss
and accuracy_score
#27137
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
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.
Thanks for the PR. See the reply to your question in the comments below:
@ogrisel I think I'll wait for this PR to be merged before working on other metrics, so that the addition of tests doesn't conflict or become redundant. What do you think? |
Thank you everyone for the feedback. :) I have updated the PR @ogrisel , should we test the multilabel case? Or when y is multilabel, is it always transformed into a sparse matrix?
|
If think we can leave the multilabel out of the scope of this PR. Not sure hiw we could tackle it. I for the atol helper, we can put in the same module as other array api helpers for now. Since it's private we can always change later. |
Ok for moving _array_api_for_tests, as well. |
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.
Looks good to me.
WDYT @ogrisel
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.
I think we could improve the generic metric tests to include testing for sample_weight
when applicable.
Other than that, LGTM.
I like the |
I merged, let's do that in a follow up PR :) |
Hi both, sorry for the late reply I am a bit busy these days. I will likely make a follow-up PR during the weekend (if it is not done by then) Thank you for merging :) |
Reference Issues/PRs
Towards #26024
What does this implement/fix? Explain your changes.
It makes the
zero_one_loss
andaccuracy_score
(since it was a dependency) implementations compatible and tested with the Array API.Any other comments?
_weighted_sum
. When havingsample_weights
as floats I got the following from PyTorch:y_true
andy_pred
that is not from binary classification? 🤔