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
Add zero_division for single class prediction in MCC #28982
Labels
Comments
From the definition, its actually going into the if condition at last, to avoid division by zero:
|
Basically the solution is to provide a |
glemaitre
changed the title
sklearn.metrics.matthews_corrcoef returns incorrect values
Add zero_division for single class prediction in MCC
May 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I have found a potential edge case issue with sklearn.metrics.matthews_corrcoef. The example provided in the documentation works as expected:
However, edge cases appear when either y or y_true have only one single label.
Steps/Code to Reproduce
Expected Results
Outputs should be 1, not 0.
Actual Results
Outputs are 0.
Versions
The text was updated successfully, but these errors were encountered: