In
machine learning
Machine learning (ML) is a field of inquiry devoted to understanding and building methods that 'learn', that is, methods that leverage data to improve performance on some set of tasks. It is seen as a part of artificial intelligence.
Machine ...
, Platt scaling or Platt calibration is a way of transforming the outputs of a
classification model into a
probability distribution over classes. The method was invented by
John Platt in the context of
support vector machines
In machine learning, support vector machines (SVMs, also support vector networks) are supervised learning models with associated learning algorithms that analyze data for classification and regression analysis. Developed at AT&T Bell Laboratories ...
,
replacing an earlier method by
Vapnik,
but can be applied to other classification models.
Platt scaling works by fitting a
logistic regression
In statistics, the logistic model (or logit model) is a statistical model that models the probability of an event taking place by having the log-odds for the event be a linear function (calculus), linear combination of one or more independent var ...
model to a classifier's scores.
Description
Consider the problem of
binary classification
Binary classification is the task of classifying the elements of a set into two groups (each called ''class'') on the basis of a classification rule. Typical binary classification problems include:
* Medical testing to determine if a patient ha ...
: for inputs , we want to determine whether they belong to one of two classes, arbitrarily labeled and . We assume that the classification problem will be solved by a real-valued function , by predicting a class label . For many problems, it is convenient to get a probability
, i.e. a classification that not only gives an answer, but also a degree of certainty about the answer. Some classification models do not provide such a probability, or give poor probability estimates.
Platt scaling is an algorithm to solve the aforementioned problem. It produces probability estimates
:
,
i.e., a
logistic transformation of the classifier scores , where and are two
scalar
Scalar may refer to:
*Scalar (mathematics), an element of a field, which is used to define a vector space, usually the field of real numbers
*Scalar (physics), a physical quantity that can be described by a single element of a number field such a ...
parameters that are learned by the algorithm. Note that predictions can now be made according to
if
the probability estimates contain a correction compared to the old decision function .
The parameters and are estimated using a
maximum likelihood
In statistics, maximum likelihood estimation (MLE) is a method of estimating the parameters of an assumed probability distribution, given some observed data. This is achieved by maximizing a likelihood function so that, under the assumed sta ...
method that optimizes on the same training set as that for the original classifier . To avoid
overfitting
mathematical modeling, overfitting is "the production of an analysis that corresponds too closely or exactly to a particular set of data, and may therefore fail to fit to additional data or predict future observations reliably". An overfitt ...
to this set, a held-out
calibration set or
cross-validation can be used, but Platt additionally suggests transforming the labels to target probabilities
:
for positive samples (), and
:
for negative samples, .
Here, and are the number of positive and negative samples, respectively. This transformation follows by applying
Bayes' rule
In probability theory and statistics, Bayes' theorem (alternatively Bayes' law or Bayes' rule), named after Thomas Bayes, describes the probability of an event, based on prior knowledge of conditions that might be related to the event. For exampl ...
to a model of out-of-sample data that has a uniform prior over the labels.
The constants 1 and 2, on the numerator and denominator respectively, are derived from the application of
Laplace smoothing
In statistics, additive smoothing, also called Laplace smoothing or Lidstone smoothing, is a technique used to smooth categorical data. Given a set of observation counts \textstyle from a \textstyle -dimensional multinomial distribution wit ...
.
Platt himself suggested using the
Levenberg–Marquardt algorithm
In mathematics and computing, the Levenberg–Marquardt algorithm (LMA or just LM), also known as the damped least-squares (DLS) method, is used to solve non-linear least squares problems. These minimization problems arise especially in least s ...
to optimize the parameters, but a
Newton algorithm was later proposed that should be more
numerically stable
In the mathematical subfield of numerical analysis, numerical stability is a generally desirable property of numerical algorithms. The precise definition of stability depends on the context. One is numerical linear algebra and the other is algor ...
.
Analysis
Platt scaling has been shown to be effective for SVMs as well as other types of classification models, including
boosted models and even
naive Bayes classifier
In statistics, naive Bayes classifiers are a family of simple " probabilistic classifiers" based on applying Bayes' theorem with strong (naive) independence assumptions between the features (see Bayes classifier). They are among the simplest Baye ...
s, which produce distorted probability distributions. It is particularly effective for max-margin methods such as SVMs and boosted trees, which show sigmoidal distortions in their predicted probabilities, but has less of an effect with well-
calibrated
In measurement technology and metrology, calibration is the comparison of measurement values delivered by a device under test with those of a Standard (metrology), calibration standard of known accuracy. Such a standard could be another measurem ...
models such as
logistic regression
In statistics, the logistic model (or logit model) is a statistical model that models the probability of an event taking place by having the log-odds for the event be a linear function (calculus), linear combination of one or more independent var ...
,
multilayer perceptron
A multilayer perceptron (MLP) is a fully connected class of feedforward artificial neural network (ANN). The term MLP is used ambiguously, sometimes loosely to mean ''any'' feedforward ANN, sometimes strictly to refer to networks composed of mul ...
s, and
random forest
Random forests or random decision forests is an ensemble learning method for classification, regression and other tasks that operates by constructing a multitude of decision trees at training time. For classification tasks, the output of th ...
s.
An alternative approach to probability calibration is to fit an
isotonic regression
In statistics and numerical analysis, isotonic regression or monotonic regression is the technique of fitting a free-form line to a sequence of observations such that the fitted line is non-decreasing (or non-increasing) everywhere, and lies as ...
model to an ill-calibrated probability model. This has been shown to work better than Platt scaling, in particular when enough training data is available.
See also
*
Relevance vector machine: probabilistic alternative to the support vector machine
Notes
References
{{reflist, 30em
Probabilistic models
Statistical classification