Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

FIX zero_one_loss breaks with multilabel and Array API #29269

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

Merged
merged 5 commits into from
Jun 20, 2024

Conversation

Tialo
Copy link
Contributor

@Tialo Tialo commented Jun 14, 2024

Reference Issues/PRs

What does this implement/fix? Explain your changes.

fixes zero_one_loss bug and adds common test for multilabel metrics.

Any other comments?

code to reproduce

import numpy as np
import torch

from sklearn.metrics import zero_one_loss
from sklearn.base import config_context

with config_context(array_api_dispatch=True):
    print(zero_one_loss(
        torch.tensor([[0, 1], [1, 1], [1, 0]], dtype=torch.float64),
        torch.tensor(np.ones((3, 2)), dtype=torch.float64),
        sample_weight=torch.tensor([0, 3, 4], dtype=torch.float64)
    ))

Copy link

github-actions bot commented Jun 14, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: b1c57e9. Link to the linter CI: here

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Since array API support for those metrics where released in 1.4.0 (I believe), we need to document the fix in the changelog (targeting 1.5.1).

LGTM, besides the missing changelog entry.

@ogrisel ogrisel added this to the 1.5.1 milestone Jun 17, 2024
Copy link
Contributor

@OmarManzoor OmarManzoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise. Thanks @Tialo

doc/whats_new/v1.5.rst Outdated Show resolved Hide resolved
Tialo and others added 2 commits June 20, 2024 11:42
@OmarManzoor OmarManzoor enabled auto-merge (squash) June 20, 2024 09:02
@OmarManzoor OmarManzoor merged commit 65b2571 into scikit-learn:main Jun 20, 2024
28 checks passed
@Tialo Tialo deleted the test-multilabel-array-api branch June 20, 2024 09:59
@jeremiedbb jeremiedbb mentioned this pull request Jul 2, 2024
11 tasks
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Jul 2, 2024
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.