Skip to content

Add probability calibration visualization - #678

Open
ChidiebereNjoku wants to merge 2 commits into
interpretml:mainfrom
ChidiebereNjoku:feat/probability-calibration-625
Open

ChidiebereNjoku wants to merge 2 commits into
interpretml:mainfrom
ChidiebereNjoku:feat/probability-calibration-625

Conversation

@ChidiebereNjoku

Copy link
Copy Markdown

Description

Adds a CalibrationCurve performance explainer for binary classifiers, following the existing ROC and PR conventions.

The new explainer:

  • computes calibration data using scikit-learn’s calibration_curve
  • supports uniform and quantile binning strategies
  • displays a reliability curve against the perfect-calibration reference
  • includes a predicted-probability density plot
  • is exposed through interpret.perf and included in the performance API documentation

Unit tests cover uniform and quantile calculations, visualization output, public configuration, and invalid arguments.

Validation

  • python -m pytest python/interpret-core/tests/perf/test_curve.py python/interpret-core/tests/visual/test_plot.py -q — 10 passed
  • Ruff formatting check passed
  • Ruff import-order check passed
  • Public CalibrationCurve import verified
  • Documentation notebook JSON validated

Closes #625

Signed-off-by: ChidiebereNjoku <144056487+ChidiebereNjoku@users.noreply.github.com>
@codecov

codecov Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.36585% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.40%. Comparing base (d82ea62) to head (dbd2152).

Files with missing lines Patch % Lines
python/interpret-core/interpret/perf/_curve.py 81.81% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #678      +/-   ##
==========================================
+ Coverage   67.32%   67.40%   +0.08%     
==========================================
  Files          77       77              
  Lines       11739    11817      +78     
==========================================
+ Hits         7903     7965      +62     
- Misses       3836     3852      +16     
Flag Coverage Δ
bdist_linux_311_python 67.15% <85.36%> (+0.09%) ⬆️
bdist_linux_312_python ?
bdist_linux_313_python ?
bdist_linux_314_python 67.08% <85.36%> (+0.11%) ⬆️
bdist_linuxarm_311_python 67.19% <85.36%> (+0.11%) ⬆️
bdist_linuxarm_312_python ?
bdist_linuxarm_313_python ?
bdist_linuxarm_314_python 67.08% <85.36%> (+0.09%) ⬆️
bdist_mac_311_python 67.31% <85.36%> (+0.09%) ⬆️
bdist_mac_312_python ?
bdist_mac_313_python ?
bdist_mac_314_python 67.24% <85.36%> (+0.11%) ⬆️
bdist_win_311_python 67.35% <85.36%> (+0.09%) ⬆️
bdist_win_312_python ?
bdist_win_313_python ?
bdist_win_314_python 67.24% <85.36%> (+0.09%) ⬆️
sdist_linux_311_python ?
sdist_linux_312_python ?
sdist_linux_313_python ?
sdist_linux_314_python ?
sdist_linuxarm_311_python ?
sdist_linuxarm_312_python ?
sdist_linuxarm_313_python ?
sdist_linuxarm_314_python ?
sdist_mac_311_python ?
sdist_mac_312_python ?
sdist_mac_313_python ?
sdist_mac_314_python ?
sdist_win_311_python ?
sdist_win_312_python ?
sdist_win_313_python ?
sdist_win_314_python ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Valid floating-point classification targets can raise a class-lookup error instead of producing a calibration explanation.

1 open issue
What changed in this PR

Adds binary-classifier probability calibration to InterpretML’s performance explainers, addressing #625 alongside the existing ROC and PR tools.

Changes:

  • Computes calibration curves with uniform or quantile binning.
  • Displays reliability curves and predicted-probability distributions.
  • Adds public exports, tests, and API documentation.
File Description
python/​interpret-core/​tests/​tutils.py Registers calibration in shared explainer tests.
python/​interpret-core/​tests/​perf/​test_curve.py Tests calculations, visualization, and validation.
python/​interpret-core/​tests/​perf/​__init__.py Initializes the performance test package.
python/​interpret-core/​interpret/​visual/​plot.py Adds calibration plotting.
python/​interpret-core/​interpret/​perf/​_curve.py Implements the calibration explainer and explanation.
python/​interpret-core/​interpret/​perf/​__init__.py Exports CalibrationCurve.
docs/​interpret/​python/​api/​CalibrationCurve.ipynb Adds API documentation.
docs/​interpret/​_toc.yml Includes the new documentation page.
docs/​extras/​sitemap.xml Adds the calibration API URL.

Review effort: Balanced

Comment on lines +269 to +270
y = typify_classification(y)
if classes is None:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Probability calibration

3 participants