Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ogrisel
Copy link
Member

@ogrisel ogrisel commented Oct 3, 2025

I also tried to register those metrics in the common tests, but there are 2 failures to investigate in sklearn/metrics/tests/test_common.py.

EDIT: I also renamed THRESHOLDED_METRICS to CONTINOUS_CLASSIFICATION_METRICS (and similar) in the test code because I found the original names very confusing, since those metrics accept unthresholded predictions contrary to other classification metrics.

@github-actions
Copy link

github-actions bot commented Oct 3, 2025

✔️ Linting Passed

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

Generated for commit: 324941e. Link to the linter CI: here

@OmarManzoor
Copy link
Contributor

OmarManzoor commented Oct 6, 2025

@ogrisel I am looking into this if it's okay

@OmarManzoor OmarManzoor marked this pull request as ready for review October 6, 2025 11:46
@ogrisel
Copy link
Member Author

ogrisel commented Oct 6, 2025

Let me add a changelog entry to document the changes.

@ogrisel ogrisel marked this pull request as draft October 6, 2025 15:57
@ogrisel
Copy link
Member Author

ogrisel commented Oct 6, 2025

@OmarManzoor I am converting to draft because after profiling the new code I realized that most computation is spent in multiple redundant calls to LabelEncoder.transform. Let me refactor to avoid this.

@ogrisel ogrisel marked this pull request as ready for review October 6, 2025 16:22
@ogrisel
Copy link
Member Author

ogrisel commented Oct 6, 2025

I think this is ready for review. I did a bit of local profiling and the redundant computation has gone aways as expected, and I see a ~1.2x to ~1.5x speed-up compared to main.

Let me redo a quick benchmark for d2_log_loss_score on 1.7 to document the performance improvement (no need for d2 Brier because it has not been released yet).

@ogrisel
Copy link
Member Author

ogrisel commented Oct 6, 2025

Performance improvement over 1.7 confirmed and new changelog for the performance improvement pushed.

I think we could easily do a follow-up PR to add array API support to those metrics, but I think this PR is ready as it is.

@ogrisel ogrisel requested a review from OmarManzoor October 6, 2025 16:41
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.

This looks good. Thank you @ogrisel

@OmarManzoor OmarManzoor added the Waiting for Second Reviewer First reviewer is done, need a second one! label Oct 6, 2025
Copy link
Member

@virchan virchan left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks, @ogrisel!

@OmarManzoor, could we merge this?

@OmarManzoor OmarManzoor merged commit d0ae1a3 into scikit-learn:main Oct 7, 2025
40 checks passed
@ogrisel ogrisel deleted the d2-classification-scorer-names branch October 7, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:metrics Waiting for Second Reviewer First reviewer is done, need a second one!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants