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

Calibration: added expected calibration error (ECE) #28831

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

yanielc
Copy link

@yanielc yanielc commented Apr 14, 2024

What does this implement/fix? Explain your changes.

This PR implements the Expected Calibration Error (ECE) as a function in the sklearn.calibration module. ECE is a widely used metric used to quantify the calibration performance of probabilistic machine learning models, particularly in binary classification tasks. It measures the discrepancy between predicted probabilities and empirical probabilities across different confidence levels.

Screenshot 2024-04-14 at 14 02 08

It is used both in "classical" machine learning and deep learning, for example:

Computing the ECE follows the same initial steps as the calibration curve. So I place the common code into a new function called calibration_stats which is then called by both calibration_curve and expected_calibration_error.

Any other comments?

I have not added unit tests yet. Sending the PR to get some feedback before proceeding.

Copy link

✔️ Linting Passed

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

Generated for commit: 0c5ab33. Link to the linter CI: here

@yanielc yanielc changed the title Calibration Calibration: added expected calibration error (ECE) Apr 14, 2024
@adrinjalali
Copy link
Member

cc @glemaitre @ogrisel @lorentzenchr

@lorentzenchr
Copy link
Member

This is a duplicate of #11096, see also the discussion in the issue #18268.

@yanielc
Copy link
Author

yanielc commented Apr 15, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants