ENH implement CalibrationCurveDisplay.from_cv_results#21211
ENH implement CalibrationCurveDisplay.from_cv_results#21211glemaitre wants to merge 4 commits intoscikit-learn:mainfrom
CalibrationCurveDisplay.from_cv_results#21211Conversation
| calibrated classifier. | ||
|
|
||
| plot_uncertainty_style : {"errorbar", "fill_between", "lines"}, \ | ||
| default="errorbar" |
There was a problem hiding this comment.
I think the default should plot_uncertainty_style="lines" as it's the easier to understand without being mislead. For plot_uncertainty_style="errorbar" and plot_uncertainty_style="fill_between" we need to know that it's based on the raw standard deviation (as opposed to a pseudo confidence interval based on the standard error of the mean for instance).
There was a problem hiding this comment.
We could also accept plot_uncertainty_style=None to only plot the mean CV calibration curve without any uncertainty markers on the plot.
There was a problem hiding this comment.
Also plot_uncertainty_style="shade" or plot_uncertainty_style="shaded_area" might be easier to understand than plot_uncertainty_style="fill_between".
There was a problem hiding this comment.
I think that for the first iteration, I would rather only implement the "lines" strategy and not the others and remove this parameter from the public API.
For the record, this is the strategy followed when adding the from_cv_results method to RocCurveDisplay.
This way, we don't have to anticipate how the from_cv_results feature will interact or not with the orthogonal feature request to add fixed model uncertainty that results from the finite size sampling of the validation/calibration sets.
| default="errorbar" | ||
| Style to plot the uncertainty information. Possibilities are: | ||
|
|
||
| - "errorbar": error bars representing one standard deviation; |
There was a problem hiding this comment.
two standard deviations: 1 above and 1 below.
| return_indices : bool, default=False | ||
| Whether to return the train-test indices selected for each split. |
There was a problem hiding this comment.
Coming from #21664, I agree return_indices is useful. (I wanted to do something like this recently).
|
@glemaitre this seems cool to be continued! |
|
Yep this also pet of the CZI proposal on inspection. This would be my next effort after the tuning threshold classifier. |
CalibrationCurveDisplay.from_cv_results
|
@AnneBeyer @lucyleeow: I think @glemaitre won't have time to revive this PR for the foreseeable future, but I think it's a very interesting feature. Feel free to takeover this work in a new PR synced with the current state of the |
|
I'm slowly adding |
|
Since #30508 is merged, can this continue? Maybe @antoinebaker @AnneBaker @StefanieSenger ? |
|
I think we meant to tag @AnneBeyer, instead of @AnneBaker. :) |
|
Yes, I have this on my to-do list. |
|
I do think |

This PR intends to add the capability of plotting uncertainty of the different curves (calibration, precision-recall, roc, etc.) by using the results of cross-validation (i.e. the output of
cross_validate).TODO:
return_indicesincross_validateto store the train-test indices. It is the safest way to keep track of the train-test splits in the case of stochastic splitting strategies.from_cv_resultsin the plotting display to take advantage of the CV computation.from_cv_resultsCalibrationDisplaycalibration_curveUsage example