Skip to content

FIX zero_one_loss breaks with multilabel and Array API - #29269

Merged
OmarManzoor merged 5 commits into
scikit-learn:mainfrom
Tialo:test-multilabel-array-api
Jun 20, 2024
Merged

OmarManzoor merged 5 commits into
scikit-learn:mainfrom
Tialo:test-multilabel-array-api

Conversation

@Tialo

@Tialo Tialo commented Jun 14, 2024

Copy link
Copy Markdown
Contributor

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)
    ))

@github-actions

github-actions Bot commented Jun 14, 2024 •

Copy link
Copy Markdown

✔️ Linting Passed

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

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

@ogrisel ogrisel left a comment •

Copy link
Copy Markdown
Member

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

@OmarManzoor OmarManzoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM otherwise. Thanks @Tialo

Comment thread doc/whats_new/v1.5.rst Resolved
@OmarManzoor
OmarManzoor enabled auto-merge (squash) June 20, 2024 09:02
@OmarManzoor
OmarManzoor merged commit 65b2571 into scikit-learn:main Jun 20, 2024
@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 done
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

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants