Skip to content

ENH Change default strategy='quantile' in calibration_curve - #33908

Merged
StefanieSenger merged 33 commits into
scikit-learn:mainfrom
antoinebaker:binning_strategy_calibration_curve
Oct 12, 2026
Merged

StefanieSenger merged 33 commits into
scikit-learn:mainfrom
antoinebaker:binning_strategy_calibration_curve

Conversation

@antoinebaker

Copy link
Copy Markdown
Member

What does this implement/fix? Explain your changes.

Change the default strategy from 'uniform' to 'quantile' in calibration_curve, CalibrationDisplay.from_predictions and CalibrationDisplay.from_estimator.

Any other comments?

When estimating the calibration curve by binning, the quality of the estimate (how close it is to the true calibration curve) depends crucially on
1a. the number of bins, it seems that n_bins=n**(1/3) is best, this is tackled by #33856
1b. the binning strategy, it seems that "quantile" is better, see Roelofs et al or Nixon et al

@lorentzenchr

Copy link
Copy Markdown
Member

@github-actions github-actions Bot added the CI:Linter failure The linter CI is failing on this PR label Jun 18, 2026
@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Jun 18, 2026
@antoinebaker antoinebaker moved this to In progress in Labs Jun 19, 2026
@antoinebaker
antoinebaker marked this pull request as ready for review June 22, 2026 08:34
@antoinebaker antoinebaker moved this from In progress to PR waiting for reviews in Labs Jul 29, 2026

@StefanieSenger StefanieSenger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @antoinebaker!

LGTM, except for three small fixes:

plot_calibration_curve.py and plot_compare_calibration.py are not setting the strategy explicity and would throw the FurtureWarning. We should push a commit with the [build doc] command to see if there are more examples failing.

We usually don't use the .. versionchanged tag before the version is out. I would remove it for now.

I think the changelog entry should show up as API, not an enhancement, following the towncrier specification: https://github.com/scikit-learn/scikit-learn/blob/main/doc/whats_new/upcoming_changes/README.md

Comment thread sklearn/calibration.py Resolved
@github-actions github-actions Bot added the CI:Linter failure The linter CI is failing on this PR label Oct 6, 2026
@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Oct 6, 2026

@StefanieSenger StefanieSenger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This now looks good to me. Thanks for the catchup, @antoinebaker.

Before merging, let's please push a commit with [build doc] again,because the previous run did break before the docs were build.

@github-actions github-actions Bot added the CI:Linter failure The linter CI is failing on this PR label Oct 6, 2026
@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Oct 6, 2026
@StefanieSenger

Copy link
Copy Markdown
Member

This PR looks very good now. One tiny thing: Can we also use the error message inside of the @pytest.mark.filterwarnings("ignore::FutureWarning") marker, so we don't accidentally filter the things that we want to see?

Otherwise this is fine to merge.

@github-actions github-actions Bot added the CI:Linter failure The linter CI is failing on this PR label Oct 7, 2026
@github-actions github-actions Bot removed the CI:Linter failure The linter CI is failing on this PR label Oct 7, 2026
@StefanieSenger

Copy link
Copy Markdown
Member

The CI should settle if you push an empty commit, @antoinebaker.

@StefanieSenger
StefanieSenger merged commit d7d471a into scikit-learn:main Oct 12, 2026
37 checks passed
@github-project-automation github-project-automation Bot moved this from PR waiting for reviews to Done in Labs Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants