ENH Add Array API compatibility to zero_one_loss and accuracy_score#27137
ENH Add Array API compatibility to zero_one_loss and accuracy_score#27137ogrisel merged 14 commits intoscikit-learn:mainfrom
zero_one_loss and accuracy_score#27137Conversation
|
@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. |
ogrisel
left a comment
There was a problem hiding this comment.
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_lossandaccuracy_score(since it was a dependency) implementations compatible and tested with the Array API.Any other comments?
_weighted_sum. When havingsample_weightsas floats I got the following from PyTorch:y_trueandy_predthat is not from binary classification? 🤔