Platt Scaling
What You'll Learn
You'll learn how to convert uncalibrated model scores into well-calibrated probabilities using a simple logistic regression layer.
The Core Idea
After training a classifier, its raw output scores often don't translate directly into reliable probabilities. For example, a model might output "0.8" for many predictions, but only 60% of those turn out to be correct—the model is overconfident.
Platt Scaling fixes this by fitting a logistic regression model on top of your existing model's outputs. It learns a sigmoid transformation that maps raw scores to calibrated probabilities.
Think of it like recalibrating a thermometer that runs too hot: you're not changing how the thermometer measures, you're just adding a correction layer that adjusts the readings to match reality.
How It Works
- Train your base model (e.g., SVM, neural network) on training data
- Generate raw scores on a separate validation set (crucial: not the training set!)
- Fit a logistic regression using these raw scores as input and the true labels as targets
- Transform future predictions by passing raw scores through this fitted sigmoid
The formula is simple: P(y=1|s) = 1 / (1 + exp(A*s + B))
where s is your model's raw score, and A and B are learned parameters.
Why This Matters
Platt Scaling is particularly useful for models that output decision values rather than probabilities (like SVMs), or for models that become miscalibrated due to imbalanced data or overfitting. It's a lightweight post-processing step that dramatically improves probability quality without retraining your entire model.
Key Takeaway: Platt Scaling fits a logistic regression sigmoid to your model's raw scores, transforming them into properly calibrated probabilities—a simple but powerful post-hoc calibration technique.