Notes

Platt Scaling

If a classifier says “this email is spam with 90% probability,” you want that number to mean something in the real world: among emails given 0.9, about 90% should truly be spam. Many strong classifiers are great at ranking examples but surprisingly bad at producing trustworthy probabilities. Platt Scaling is a simple fix for that.

What Platt Scaling does

Platt Scaling is a post-processing step that turns a model’s raw scores into calibrated probabilities by fitting a small logistic regression on top of those scores. Concretely, if your model outputs a decision value s (for example, an SVM margin or a tree ensemble score), Platt scaling learns parameters A and B so that:

P(y=1 | s) = 1 / (1 + exp(A*s + B))

Those parameters are learned on a held-out calibration set (or via cross-validation), using the true labels. Think of it as learning a “probability translation layer” that reshapes scores into numbers that behave like probabilities.

Where it shows up in practice

  • Spam detection: you might only auto-delete when calibrated probability > 0.99.
  • Credit risk: pricing and approval thresholds depend on well-calibrated default probabilities.
  • Medical triage: a “0.2 risk” estimate should correspond to real observed rates.

In scikit-learn, this is exposed through

CalibratedClassifierCV(method="sigmoid")
where “sigmoid” is Platt scaling.

Why it matters (and what can go wrong)

Calibration affects any decision that uses probability values: thresholding, expected-cost decisions, and combining models. If you ignore it, you can get confident-looking probabilities that are systematically too high or too low, leading to brittle business rules. Platt scaling is fast and stable, but it assumes a sigmoid-shaped correction; if calibration errors are more irregular, isotonic regression can fit a more flexible mapping (at higher overfitting risk).

Platt Scaling is a post-hoc probability calibration method that fits a logistic regression (sigmoid) mapping from a classifier’s raw scores (e.g., SVM margins or logits) to calibrated class probabilities, typically using a held-out validation set. It matters because many classifiers produce poorly calibrated scores; Platt scaling converts them into reliable probabilities needed for thresholding, risk-sensitive decisions, and metrics like log loss and expected calibration error.

Imagine a weather app that says there’s a 70% chance of rain. If, on days it says “70%,” it actually rains about 7 times out of 10, you trust it. That “matching reality” idea is called calibration.

Platt Scaling is a simple way to fix a classifier’s confidence so its “probabilities” behave more like that weather forecast. Some models are good at ranking (this email seems more spammy than that one) but their raw scores aren’t trustworthy as real chances. Platt Scaling takes those scores and converts them into more realistic probabilities, so “0.9” really means “about 90% of the time.”