Skip to content

CalibratedClassifierCV(method="sigmoid") should always take the raw logits as inputs instead of the predicted probabilities #34312

Closed

Description

@ogrisel

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).

CalArena: A Large-Scale Post-Hoc Calibration Benchmark
https://arxiv.org/abs/2605.30188

Image Image

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?

Activity

  1. moved this to Todo in Labson Jun 16, 2026
  2. moved this from Todo to In progress in Labson Jun 16, 2026
  3. lorentzenchr commented on Jun 20, 2026

    @lorentzenchr
    Member

    +1 for the proposed change. I would even do it as a bugfix.

  4. eugeneberta commented on Jul 6, 2026

    @eugeneberta

    @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):

    Image

    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.

  5. ogrisel commented on Jul 8, 2026

    @ogrisel
    MemberAuthor

    Thanks for putting in the work to confirm this intuition.

  6. moved this from In progress to PR waiting for reviews in Labson Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions