Skip to content
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

[BUG] label_binarize is different from sklearn for binary class. #5740

Closed
trivialfis opened this issue Feb 1, 2024 · 1 comment · Fixed by #5900
Closed

[BUG] label_binarize is different from sklearn for binary class. #5740

trivialfis opened this issue Feb 1, 2024 · 1 comment · Fixed by #5900
Assignees
Labels
? - Needs Triage Need team to review and classify bug Something isn't working

Comments

@trivialfis
Copy link
Member

Describe the bug
scikit-learn transforms the binary class into a single column: https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.label_binarize.html , while cuML returns the full matrix for negative and positive classes.

cuml: 24.02
sklearn: 1.4.0

Steps/Code to reproduce bug

>>> from cuml.preprocessing import label_binarize
>>> label_binarize(cp.array([1, 0, 1, 1]), classes=cp.array([0, 1]))
array([[0, 1],
       [1, 0],
       [0, 1],
       [0, 1]])
@trivialfis trivialfis added bug Something isn't working ? - Needs Triage Need team to review and classify labels Feb 1, 2024
@jinsolp
Copy link
Contributor

jinsolp commented May 20, 2024

Working on this one!

rapids-bot bot pushed a commit that referenced this issue May 22, 2024
Closes #5740 

Fix for cuml's `label_binarize` to have the same output as scikit-learn's `label_binarize` for binary classes.

Note: Unlike scikit-learn's [`scipy.sparse._csr.csr_matrix.getcol()`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.getcol.html), cuml's `cupyx.scipy.sparse.csr_matrix.getcol()` does not support -1 indexing.

Authors:
  - Jinsol Park (https://github.com/jinsolp)

Approvers:
  - Divye Gala (https://github.com/divyegala)

URL: #5900
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - Needs Triage Need team to review and classify bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants