# Calibration

## Calibration :

Calibration is the process of adjusting a model so that its predictions are accurate and reliable. In other words, it is the process of ensuring that a model’s predicted probabilities match the true probabilities of the events it is predicting. This is important because, without calibration, a model’s predictions may be overly confident or not confident enough, leading to poor decision making.
To understand calibration, it’s helpful to consider a simple example. Imagine you are trying to predict the probability that a coin will land on heads when flipped. A calibrated model would predict a probability of 0.5 (or 50%) for this event, because that is the true probability of the coin landing on heads. An uncalibrated model, on the other hand, might predict a probability of 0.6 (or 60%) for this event, indicating that it is more confident in its prediction than it should be.
Calibration can be assessed using a calibration curve, which plots the predicted probabilities of an event against the true probabilities of that event. A well-calibrated model will have a calibration curve that is close to the 45-degree line, which indicates that the model’s predicted probabilities match the true probabilities. In contrast, an uncalibrated model will have a calibration curve that is either above or below the 45-degree line, indicating that its predicted probabilities are either too high or too low.
There are several ways to calibrate a model, depending on the type of model and the data it is trained on. One common method is Platt scaling, which involves fitting a sigmoid function to the output of the model. The sigmoid function maps the output of the model to a probability range of 0 to 1, which is the range of probabilities that the model should predict. This method can be applied to models that output continuous values, such as logistic regression or support vector machines.
Another method is isotonic regression, which involves fitting a monotonic function to the output of the model. A monotonic function is a function that either increases or decreases as the input increases. Isotonic regression can be applied to models that output either continuous or discrete values, such as decision trees or random forests.
Calibration is an important aspect of model evaluation, as it ensures that a model’s predictions are accurate and reliable. Without calibration, a model’s predictions may be overly confident or not confident enough, leading to poor decision making. By assessing a model’s calibration using a calibration curve, you can ensure that the model is making predictions that are well-calibrated and can be trusted.