scikit-learn icon indicating copy to clipboard operation
scikit-learn copied to clipboard

ENH Add `zero_division` parameter for `accuracy_score`

Open Jaimin020 opened this issue 1 year ago • 5 comments

Introduce the zero_division parameter to the accuracy_score function when y_true and y_pred are empty.

Reference Issues/PRs

Make zero_division parameter consistent in the different metric #29048 (Task-1)

What does this implement/fix? Explain your changes.

I have verified the lengths of the variables "y_true" and "y_pred." If both lengths are 0, I have generated an output based on the value of the "zero_warning" variable.

Any other comments?

Jaimin020 avatar Jun 07 '24 17:06 Jaimin020

✔️ Linting Passed

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

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

github-actions[bot] avatar Jun 07 '24 17:06 github-actions[bot]

Hi @Jaimin020,

regarding the CodeCov failures: you need to add accuracy_score to the tests in test_classification.py. The output of the CI seems not very helpful here however. Normally, the precise lines of the uncovered code should show up in the "Files changed" tab.

StefanieSenger avatar Jun 10 '24 07:06 StefanieSenger

Hii, @StefanieSenger

I have made all the changes you mentioned.

Jaimin020 avatar Jun 10 '24 16:06 Jaimin020

Hii, @StefanieSenger and @glemaitre

I've implemented all the changes suggested by @StefanieSenger. @glemaitre, please review this PR and let me know if any further modifications are needed.

Jaimin020 avatar Jun 12 '24 08:06 Jaimin020

Hii @glemaitre,

I have implemented all the changes you requested. Please review it.

Jaimin020 avatar Jun 15 '24 15:06 Jaimin020

LGTM @Jaimin020.

I quickly pushed a commit to merge main in the branch and just modify the message related to skipping the test that is rather a nitpick.

We will need a second approval.

Thanks @glemaitre for the quick update and merge with the main branch.

Jaimin020 avatar Jul 24 '24 13:07 Jaimin020