How to Calibrate Your Classifier's Probabilities in Scikit-Learn
KDnuggets, Tuesday, November 17th, 2026
A KDnuggets tutorial shows how to calibrate scikit-learn classifier probabilities with Platt scaling and isotonic regression.
This KDnuggets tutorial trains naive Bayes and random forest classifiers on a 100,000-row sample of the Covertype dataset and shows that accuracy and ROC-AUC do not reveal whether a 0.9 score means a 90% chance.
It uses a three-way split into training, calibration and test sets, then exposes miscalibration with reliability diagrams, the Brier score and log loss, and its fixes use CalibratedClassifierCV with FrozenEstimator, which requires scikit-learn 1.6 or later.
Platt scaling learns two parameters, preserves ranking and suits small calibration sets, while isotonic regression is more flexible but prone to overfitting below roughly 1,000 samples.
Without spare data, five-fold cross-validated calibration is suggested, and the calibrator should never be fit on training data.