You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add PAV algorithm for calibration_curve/reliability diagrams #23132
Add the strategy PAV as [1] and [2] to calibration_curve, there called CORP. This is basically applying isotonic regression as binning strategy, which we already have in scikit-learn.
Describe alternatives you've considered, if relevant
No response
Additional context
Given the recency of the paper, it has clearly not enough citations (yet). But I have the impression that this is a good strategy for a reliability diagrams with good theoretical and practical properties.
To my knowledge, this strategy is nowhere available in the Python universe as of now.
Reacted by Eike Petersen, Sadegh, Fran Bartolić and Shruti Nath
It's possible that using Centered Isotonic Regression (#21454) would make the reliability diagram look even better but might break the theoretical results of the paper you linked above.
@ogrisel As pointed out in #21454, centered isotonic regression seems to be an invalid option because it is not calibrated itself which is a crucial property of (standard) isotonic regression, in particular important for assessing (auto-) calibration of a model as is done in a reliability diagram.
The reliability diagram is a statistical diagnostics/verification tool and not something that needs to be pleasant for the eye, but easy to interpret.
The zigzag is a mere consequence of the underlying (small sample) uncertainty in the estimation of $E[Y|prediction]$.
BTW, I never understood why the PAV (=CORP) approach is good enough for calibration of classifiers (modifies actual model predictions), but not good enough in a reliability diagram (diagnostics) - within scikit-learn 🤨
The reliability diagram is a statistical diagnostics/verification tool and not something that needs to be pleasant for the eye, but easy to interpret.
It's not a matter of being pleasing to the eye but a matter about being misleading about the shape of the asymptotic curve. The asymptotic curve will be smooth most of the time, and the CORP finite sample size estimate can induce the reader into thinking otherwise, which I find misleading and a potential source of confusion for our users.
BTW, I never understood why the PAV (=CORP) approach is good enough for calibration of classifiers (modifies actual model predictions), but not good enough in a reliability diagram (diagnostics) - within scikit-learn
I actually have the exact same concern with isotonic regression as a post hoc calibrator. I would much rather use the centered isotonic regression as post hoc classifier which is mostly strictly monotonic (and as a result would not introduce an unexpected change to pure ranking metrics such as ROC AUC / Gini index) and converges to the same solution as the step-wise constant calibrator in the large sample size.
That‘s not correct. For instance, tree based models or GLMs with categorical features are not smooth in the predictions.
Indeed that might be the case. Although depending on the size of the training set, I suspect that they are still be much smoother than what the CORP reliability diagram suggests. To settle this debate we will need some experiments with a few large datasets we we can subsample both the training set and the test set used to estimate the reliability curve and compare the small test sample CORP/smoothed reliability curves to the CORP curve on the full test set.
We could also have a reliability diagram with a user settable option to decide what strategy they want to use (fixed binning as we do now, CORP induced bin edges and some smooth estimate). Still comparing the methods on a few canonical datasets would help us make informed recommendations in the docstring of that parameter.
Activity
lorentzenchr commentedon Apr 14, 2022
@aijordan For your information.
ogrisel commentedon Apr 20, 2022
It's possible that using Centered Isotonic Regression (#21454) would make the reliability diagram look even better but might break the theoretical results of the paper you linked above.
lorentzenchr commentedon Aug 25, 2022
@ogrisel As pointed out in #21454, centered isotonic regression seems to be an invalid option because it is not calibrated itself which is a crucial property of (standard) isotonic regression, in particular important for assessing (auto-) calibration of a model as is done in a reliability diagram.
lorentzenchr commentedon Dec 10, 2023
Posted by @ogrisel in #23767 (comment)
lorentzenchr commentedon Dec 10, 2023
@ogrisel
As Prof Simon Woods says:
The reliability diagram is a statistical diagnostics/verification tool and not something that needs to be pleasant for the eye, but easy to interpret.$E[Y|prediction]$ .
The zigzag is a mere consequence of the underlying (small sample) uncertainty in the estimation of
BTW, I never understood why the PAV (=CORP) approach is good enough for calibration of classifiers (modifies actual model predictions), but not good enough in a reliability diagram (diagnostics) - within scikit-learn 🤨
ogrisel commentedon Dec 10, 2023
It's not a matter of being pleasing to the eye but a matter about being misleading about the shape of the asymptotic curve. The asymptotic curve will be smooth most of the time, and the CORP finite sample size estimate can induce the reader into thinking otherwise, which I find misleading and a potential source of confusion for our users.
I actually have the exact same concern with isotonic regression as a post hoc calibrator. I would much rather use the centered isotonic regression as post hoc classifier which is mostly strictly monotonic (and as a result would not introduce an unexpected change to pure ranking metrics such as ROC AUC / Gini index) and converges to the same solution as the step-wise constant calibrator in the large sample size.
lorentzenchr commentedon Dec 11, 2023
That‘s not correct. For instance, tree based models or GLMs with categorical features are not smooth in the predictions.
ogrisel commentedon Dec 11, 2023
Indeed that might be the case. Although depending on the size of the training set, I suspect that they are still be much smoother than what the CORP reliability diagram suggests. To settle this debate we will need some experiments with a few large datasets we we can subsample both the training set and the test set used to estimate the reliability curve and compare the small test sample CORP/smoothed reliability curves to the CORP curve on the full test set.
We could also have a reliability diagram with a user settable option to decide what strategy they want to use (fixed binning as we do now, CORP induced bin edges and some smooth estimate). Still comparing the methods on a few canonical datasets would help us make informed recommendations in the docstring of that parameter.
antoinebaker commentedon Apr 29, 2026
+1 to add the option in
calibration_curve.Do we have your go @ogrisel ?
lorentzenchr commentedon May 1, 2026
Crossref the info comment #18268 (comment).