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
CalibratedClassifierCV(method="sigmoid") should always take the raw logits as inputs instead of the predicted probabilities #34312
This is a defect I first observed while reviewing the temperature scaling PR: if the uncalibrated classifier only exposes a decision_function and no predict_proba (which is the case for SVMs for instance) our implementation of sigmoid calibration (aka Platt-scaling) is fine because the output values of decision_function are morally logits between -inf and +inf with 0 as the default decision threshold.
But if the uncalibrated classifier already exposes a predict_proba method (e.g. GaussianNB), our current implementation takes the predicted probabilities as input of the parametrized sigmoid function. This is incorrect: we should the log of the probabilistic predictions (incremented by a small epsilon) to feed logits as inputs to the sigmoid function.
I had started an unfinished WIP branch now turned into a draft PR (#34313) to attempt to fix this problem and started to do empirical evaluation to assess the impact of this change in examples. Early results were very promising. However, it would now need work to be sync with main again after the merge of the temperature scaling PR and I got distracted and this was burried in my personal TODO list of WIP stuff to revive.
Meanwhile, the following paper by @eugeneberta, @dholzmueller et al. was published, and it confirms that it is empirically much better to take the logits, in which case it is a very competitive calibration method (better than most other calibration methods on average on a large set of data & model pairs).
Side note: I suspect that OvR Platt-logits followed by post-hoc class-wise renormalization would also work very well in the multiclass setting, but this does not seem to have been explored in the above paper from a cursory glance. Do you confirm @eugeneberta, @dholzmueller?
@ogrisel indeed we did not experiment with OvR Platt-scaling on the logits in the paper, I just ran the experiment quickly and as you had guessed it performs quite well (it is also fast since Platt-scaling is lightweight), see the updated multi-class leaderboard below, where it ranks fifth overall and second to Spline calibration among methods that are applied OvR (VS, SVS and SMS are natively multi-class methods):
For reference, the specific configuration that I tried is (using probmetrics): MulticlassOneVsRestCalibrator( BinaryLogisticCalibrator(type="affine") )
Will add this in the next version of the paper, thanks for the wise idea.
Activity
lorentzenchr commentedon Jun 20, 2026
+1 for the proposed change. I would even do it as a bugfix.
eugeneberta commentedon Jul 6, 2026
@ogrisel indeed we did not experiment with OvR Platt-scaling on the logits in the paper, I just ran the experiment quickly and as you had guessed it performs quite well (it is also fast since Platt-scaling is lightweight), see the updated multi-class leaderboard below, where it ranks fifth overall and second to Spline calibration among methods that are applied OvR (VS, SVS and SMS are natively multi-class methods):
For reference, the specific configuration that I tried is (using probmetrics):
MulticlassOneVsRestCalibrator( BinaryLogisticCalibrator(type="affine") )Will add this in the next version of the paper, thanks for the wise idea.
ogrisel commentedon Jul 8, 2026
Thanks for putting in the work to confirm this intuition.