Scoring rule

In decision theory, a scoring rule provides evaluation metrics for probabilistic predictions or forecasts. While "regular" loss functions (such as mean squared error) assign a goodness-of-fit score to a predicted value and an observed value, scoring rules assign such a score to a predicted probability distribution and an observed value. On the other hand, a scoring function provides a summary measure for the evaluation of point predictions, i.e. one predicts a property or functional T ( F ) {\displaystyle T(F)} , like the expectation or the median.
Scoring rules answer the question "how good is a predicted probability distribution compared to an observation?" Scoring rules that are (strictly) proper are proven to have the lowest expected score if the predicted distribution equals the underlying distribution of the target variable. Although this might differ for individual observations, this should result in a minimization of the expected score if the "correct" distributions are predicted.
Scoring rules and scoring functions are often used as "cost functions" or "loss functions" of probabilistic forecasting models. They are evaluated as the empirical mean of a given sample, the "score". Scores of different predictions or models can then be compared to conclude which model is best. For example, consider a model, that predicts (based on an input x {\displaystyle x} ) a mean μ ∈ R {\displaystyle \mu \in \mathbb {R} } and standard deviation σ ∈ R + {\displaystyle \sigma \in \mathbb {R} _{+}} . Together, those variables define a gaussian distribution N ( μ , σ 2 ) {\displaystyle {\mathcal {N}}(\mu ,\sigma ^{2})} , in essence predicting the target variable as a probability distribution. A common interpretation of probabilistic models is that they aim to quantify their own predictive uncertainty. In this example, an observed target variable y ∈ R {\displaystyle y\in \mathbb {R} } is then held compared to the predicted distribution N ( μ , σ 2 ) {\displaystyle {\mathcal {N}}(\mu ,\sigma ^{2})} and assigned a score L ( N ( μ , σ 2 ) , y ) ∈ R {\displaystyle {\mathcal {L}}({\mathcal {N}}(\mu ,\sigma ^{2}),y)\in \mathbb {R} } . When training on a scoring rule, it should "teach" a probabilistic model to predict when its uncertainty is low, and when its uncertainty is high, and it should result in calibrated predictions, while minimizing the predictive uncertainty.
Although the example given concerns the probabilistic forecasting of a real valued target variable, a variety of different scoring rules have been designed with different target variables in mind. Scoring rules exist for binary and categorical probabilistic classification, as well as for univariate and multivariate probabilistic regression.
Consider a sample space Ω {\displaystyle \Omega } , a σ-algebra A {\displaystyle {\mathcal {A}}} of subsets of Ω {\displaystyle \Omega } and a convex class F {\displaystyle {\mathcal {F}}} of probability measures on ( Ω , A ) {\displaystyle (\Omega ,{\mathcal {A}})} . A function defined on Ω {\displaystyle \Omega } and taking values in the extended real line, R ¯ = [ − ∞ , ∞ ] {\displaystyle {\overline {\mathbb {R} }}=[-\infty ,\infty ]} , is F {\displaystyle {\mathcal {F}}} -quasi-integrable if it is measurable with respect to A {\displaystyle {\mathcal {A}}} and is quasi-integrable with respect to all F ∈ F {\displaystyle F\in {\mathcal {F}}} .
A probabilistic forecast is any probability measure F ∈ F {\displaystyle F\in {\mathcal {F}}} . I.e. it is a distribution of potential future observations.
A scoring rule is any extended real-valued function S : F × Ω → R {\displaystyle \mathbf {S} :{\mathcal {F}}\times \Omega \rightarrow \mathbb {R} } such that S ( F , ⋅ ) {\displaystyle \mathbf {S} (F,\cdot )} is F {\displaystyle {\mathcal {F}}} -quasi-integrable for all F ∈ F {\displaystyle F\in {\mathcal {F}}} . S ( F , y ) {\displaystyle \mathbf {S} (F,y)} represents the loss or penalty when the forecast F ∈ F {\displaystyle F\in {\mathcal {F}}} is issued and the observation y ∈ Ω {\displaystyle y\in \Omega } materializes.
A point forecast is a functional, i.e. a potentially set-valued mapping F → T ( F ) ⊆ Ω {\displaystyle F\rightarrow T(F)\subseteq \Omega } .
A scoring function is any real-valued function S : Ω × Ω → R {\displaystyle S:\Omega \times \Omega \rightarrow \mathbb {R} } where S ( x , y ) {\displaystyle S(x,y)} represents the loss or penalty when the point forecast x ∈ Ω {\displaystyle x\in \Omega } is issued and the observation y ∈ Ω {\displaystyle y\in \Omega } materializes.
Scoring rules S ( F , y ) {\displaystyle \mathbf {S} (F,y)} and scoring functions S ( x , y ) {\displaystyle S(x,y)} are negatively (positively) oriented if smaller (larger) values mean better. Here we adhere to negative orientation, hence the association with "loss".
We write for the expected score of a prediction F {\displaystyle F} under Q ∈ F {\displaystyle Q\in {\mathcal {F}}} as the expected score of the predicted distribution F ∈ F {\displaystyle F\in {\mathcal {F}}} , when sampling observations from distribution Q {\displaystyle Q} .
Many probabilistic forecasting models are training via the sample average score, in which a set of predicted distributions F 1 , … , F n ∈ F {\displaystyle F_{1},\ldots ,F_{n}\in {\mathcal {F}}} is evaluated against a set of observations y 1 , … , y n ∈ Ω {\displaystyle y_{1},\ldots ,y_{n}\in \Omega } .
Strictly proper scoring rules and strictly consistent scoring functions encourage honest forecasts by maximization of the expected reward: If a forecaster is given a reward of − S ( F , y ) {\displaystyle -\mathbf {S} (F,y)} if y {\displaystyle y} realizes (e.g. y = r a i n {\displaystyle y=rain} ), then the highest expected reward (lowest score) is obtained by reporting the true probability distribution.
A scoring rule S {\displaystyle \mathbf {S} } is proper relative to F {\displaystyle {\mathcal {F}}} if (assuming negative orientation) its expected score is minimized when the forecasted distribution matches the distribution of the observation.
It is strictly proper if the above equation holds with equality if and only if F = Q {\displaystyle F=Q} .
A scoring function S {\displaystyle S} is consistent for the functional T {\displaystyle T} relative to the class F {\displaystyle {\mathcal {F}}} if
It is strictly consistent if it is consistent and equality in the above equation implies that x ∈ T ( F ) {\displaystyle x\in T(F)} .
An example of probabilistic forecasting is in meteorology where a weather forecaster may give the probability of rain on the next day. One could note the number of times that a 25% probability was quoted, over a long period, and compare this with the actual proportion of times that rain fell. If the actual percentage was substantially different from the stated probability we say that the forecaster is poorly calibrated. A poorly calibrated forecaster might be encouraged to do better by a bonus system. A bonus system designed around a proper scoring rule will incentivize the forecaster to report probabilities equal to his personal beliefs.
In addition to the simple case of a binary decision, such as assigning probabilities to 'rain' or 'no rain', scoring rules may be used for multiple classes, such as 'rain', 'snow', or 'clear', or continuous responses like the amount of rain per day.
The image to the right shows an example of a scoring rule, the logarithmic scoring rule, as a function of the probability reported for the event that actually occurred. One way to use this rule would be as a cost based on the probability that a forecaster or algorithm assigns, then checking to see which event actually occurs.
There are an infinite number of scoring rules, including entire parameterized families of strictly proper scoring rules. The ones shown below are simply popular examples.
For a categorical response variable with m {\displaystyle m} mutually exclusive events, Y ∈ Ω = { 1 , … , m } {\displaystyle Y\in \Omega =\{1,\ldots ,m\}} , a probabilistic forecaster or algorithm will return a probability vector r {\displaystyle \mathbf {r} } with a probability for each of the m {\displaystyle m} outcomes.
The logarithmic scoring rule is a local strictly proper scoring rule. This is also the negative of surprisal, which is commonly used as a scoring criterion in Bayesian inference; the goal is to minimize expected surprise. This scoring rule has strong foundations in information theory.
Here, the score is calculated as the logarithm of the probability estimate for the actual outcome. That is, a prediction of 80% that correctly proved true would receive a score of ln(0.8) = −0.22. This same prediction also assigns 20% likelihood to the opposite case, and so if the prediction proves false, it would receive a score based on the 20%: ln(0.2) = −1.6. The goal of a forecaster is to maximize the score and for the score to be as large as possible, and −0.22 is indeed larger than −1.6.
If one treats the truth or falsity of the prediction as a variable x with value 1 or 0 respectively, and the expressed probability as p, then one can write the logarithmic scoring rule as x ln(p) + (1 − x) ln(1 − p). Note that any logarithmic base may be used, since strictly proper scoring rules remain strictly proper under linear transformation. That is:
is strictly proper for all b > 1 {\displaystyle b>1} .
The quadratic scoring rule is a strictly proper scoring rule
where r i {\displaystyle r_{i}} is the probability assigned to the correct answer and C {\displaystyle C} is the number of classes.
The Brier score, originally proposed by Glenn W. Brier in 1950, can be obtained by an affine transform from the quadratic scoring rule.
Where y j = 1 {\displaystyle y_{j}=1} when the j {\displaystyle j} th event is correct and y j = 0 {\displaystyle y_{j}=0} otherwise and C {\displaystyle C} is the number of classes.
An important difference between these two rules is that a forecaster should strive to maximize the quadratic score Q {\displaystyle Q} yet minimize the Brier score B {\displaystyle B} . This is due to a negative sign in the linear transformation between them.
The spherical scoring rule is also a strictly proper scoring rule
The ranked probability score (RPS) is a strictly proper scoring rule, that can be expressed as:
Where y j = 1 {\displaystyle y_{j}=1} when the j {\displaystyle j} th event is correct and y j = 0 {\displaystyle y_{j}=0} otherwise, and C {\displaystyle C} is the number of classes. Other than other scoring rules, the ranked probability score considers the distance between classes, i.e. classes 1 and 2 are considered closer than classes 1 and 3. The score assigns better scores to probabilistic forecasts with high probabilities assigned to classes close to the correct class. For example, when considering probabilistic forecasts r 1 = ( 0.5 , 0.5 , 0 ) {\displaystyle \mathbf {r} _{1}=(0.5,0.5,0)} and r 2 = ( 0.5 , 0 , 0.5 ) {\displaystyle \mathbf {r} _{2}=(0.5,0,0.5)} , we find that R P S ( r 1 , 1 ) = 0.25 {\displaystyle RPS(\mathbf {r} _{1},1)=0.25} , while R P S ( r 2 , 1 ) = 0.5 {\displaystyle RPS(\mathbf {r} _{2},1)=0.5} , despite both probabilistic forecasts assigning identical probability to the correct class.
Shown below on the left is a graphical comparison of the Logarithmic, Quadratic, and Spherical scoring rules for a binary classification problem. The x-axis indicates the reported probability for the event that actually occurred.
It is important to note that each of the scores have different magnitudes and locations. The magnitude differences are not relevant however as scores remain proper under affine transformation. Therefore, to compare different scores it is necessary to move them to a common scale. A reasonable choice of normalization is shown at the picture on the right where all scores intersect the points (0.5,0) and (1,1). This ensures that they yield 0 for a uniform distribution (two probabilities of 0.5 each), reflecting no cost or reward for reporting what is often the baseline distribution. All normalized scores below also yield 1 when the true class is assigned a probability of 1.
The scoring rules listed below aim to evaluate probabilistic predictions when the predicted distributions are univariate continuous probability distribution's, i.e. the predicted distributions are defined over a univariate target variable X ∈ R {\displaystyle X\in \mathbb {R} } and have a probability density function f : R → R + {\displaystyle f:\mathbb {R} \to \mathbb {R} _{+}} .
The logarithmic score is a local strictly proper scoring rule. It is defined as
where f D {\displaystyle f_{D}} denotes the probability density function of the predicted distribution D {\displaystyle D} . It is a local, strictly proper scoring rule. The logarithmic score for continuous variables has strong ties to Maximum likelihood estimation. However, in many applications, the continuous ranked probability score is often preferred over the logarithmic score, as the logarithmic score can be heavily influenced by slight deviations in the tail densities of forecasted distributions.
The continuous ranked probability score (CRPS) is a strictly proper scoring rule much used in meteorology. It is defined as
where F D {\displaystyle F_{D}} is the cumulative distribution function of the forecasted distribution D {\displaystyle D} , H {\displaystyle H} is the Heaviside step function and y ∈ R {\displaystyle y\in \mathbb {R} } is the observation. For distributions with finite first moment, the continuous ranked probability score can be written as:
where X {\displaystyle X} and X ′ {\displaystyle X'} are independent random variables, sampled from the distribution D {\displaystyle D} . Furthermore, when the cumulative probability function F {\displaystyle F} is continuous, the continuous ranked probability score can also be written as
The continuous ranked probability score can be seen as both an continuous extension of the ranked probability score, as well as quantile regression. The continuous ranked probability score over the empirical distribution D ^ q {\displaystyle {\hat {D}}_{q}} of an ordered set points q 1 ≤ … ≤ q n {\displaystyle q_{1}\leq \ldots \leq q_{n}} (i.e. every point has 1 / n {\displaystyle 1/n} probability of occurring), is equal to twice the mean quantile loss applied on those points with evenly spread quantiles ( τ 1 , … , τ n ) = ( 1 / ( 2 n ) , … , ( 2 n − 1 ) / ( 2 n ) ) {\displaystyle (\tau _{1},\ldots ,\tau _{n})=(1/(2n),\ldots ,(2n-1)/(2n))} :
For many popular families of distributions, closed-form expressions for the continuous ranked probability score have been derived. The continuous ranked probability score has been used as a loss function for artificial neural networks, in which weather forecasts are postprocessed to a Gaussian probability distribution.
CRPS was also adapted to survival analysis to cover censored events.
The scoring rules listed below aim to evaluate probabilistic predictions when the predicted distributions are univariate continuous probability distribution's, i.e. the predicted distributions are defined over a multivariate target variable X ∈ R n {\displaystyle X\in \mathbb {R} ^{n}} and have a probability density function f : R n → R + {\displaystyle f:\mathbb {R} ^{n}\to \mathbb {R} _{+}} .
The multivariate logarithmic score is similar to the univariate logarithmic score:
where f D {\displaystyle f_{D}} denotes the probability density function of the predicted multivariate distribution D {\displaystyle D} . It is a local, strictly proper scoring rule.
The Hyvärinen scoring function (of a density p) is defined by
Where Δ {\displaystyle \Delta } denotes the Hessian trace and ∇ {\displaystyle \nabla } denotes the gradient. This scoring rule can be used to computationally simplify parameter inference and address Bayesian model comparison with arbitrarily-vague priors. It was also used to introduce new information-theoretic quantities beyond the existing information theory.
The energy score is a multivariate extension of the continuous ranked probability score:
Here, β ∈ ( 0 , 2 ) {\displaystyle \beta \in (0,2)} , ‖ ‖ 2 {\displaystyle \lVert \rVert _{2}} denotes the n {\displaystyle n} -dimensional Euclidean distance and X , X ′ {\displaystyle X,X'} are independently sampled random variables from the probability distribution D {\displaystyle D} . The energy score is strictly proper for distributions D {\displaystyle D} for which E X ∼ D [ ‖ X ‖ 2 ] {\displaystyle \mathbb {E} _{X\sim D}[\lVert X\rVert _{2}]} is finite. It has been suggested that the energy score is somewhat ineffective when evaluating the intervariable dependency structure of the forecasted multivariate distribution. The energy score is equal to twice the energy distance between the predicted distribution and the empirical distribution of the observation.
The variogram score of order p {\displaystyle p} is given by:
Here, w i j {\displaystyle w_{ij}} are weights, often set to 1, and p > 0 {\displaystyle p>0} can be arbitrarily chosen, but p = 0.5 , 1 {\displaystyle p=0.5,1} or 2 {\displaystyle 2} are often used. X i {\displaystyle X_{i}} is here to denote the i {\displaystyle i} 'th marginal random variable of X {\displaystyle X} . The variogram score is proper for distributions for which the ( 2 p ) {\displaystyle (2p)} 'th moment is finite for all components, but is never strictly proper. Compared to the energy score, the variogram score is claimed to be more discriminative with respect to the predicted correlation structure.
The conditional continuous ranked probability score (Conditional CRPS or CCRPS) is a family of (strictly) proper scoring rules. Conditional CRPS evaluates a forecasted multivariate distribution D {\displaystyle D} by evaluation of CRPS over a prescribed set of univariate conditional probability distributions of the predicted multivariate distribution:
Here, X i {\displaystyle X_{i}} is the i {\displaystyle i} 'th marginal variable of X ∼ D {\displaystyle X\sim D} , T = ( v i , C i ) i = 1 k {\displaystyle {\mathcal {T}}=(v_{i},{\mathcal {C}}_{i})_{i=1}^{k}} is a set of tuples that defines a conditional specification (with v i ∈ { 1 , … , n } {\displaystyle v_{i}\in \{1,\ldots ,n\}} and C i ⊆ { 1 , … , n } ∖ { v i } {\displaystyle {\mathcal {C}}_{i}\subseteq \{1,\ldots ,n\}\setminus \{v_{i}\}} ), and P X ∼ D ( X v i | X j = Y j for j ∈ C i ) {\displaystyle P_{X\sim D}(X_{v_{i}}|X_{j}=Y_{j}{\text{ for }}j\in {\mathcal {C}}_{i})} denotes the conditional probability distribution for X v i {\displaystyle X_{v_{i}}} given that all variables X j {\displaystyle X_{j}} for j ∈ C i {\displaystyle j\in {\mathcal {C}}_{i}} are equal to their respective observations. In the case that P X ∼ D ( X v i | X j = Y j for j ∈ C i ) {\displaystyle P_{X\sim D}(X_{v_{i}}|X_{j}=Y_{j}{\text{ for }}j\in {\mathcal {C}}_{i})} is ill-defined (i.e. its conditional event has zero likelihood), CRPS scores over this distribution are defined as infinite. Conditional CRPS is strictly proper for distributions with finite first moment, if the chain rule is included in the conditional specification, meaning that there exists a permutation ϕ 1 , … , ϕ n {\displaystyle \phi _{1},\ldots ,\phi _{n}} of 1 , … , n {\displaystyle 1,\ldots ,n} such that for all 1 ≤ i ≤ n {\displaystyle 1\leq i\leq n} : ( ϕ i , { ϕ 1 , … , ϕ i − 1 } ) ∈ T {\displaystyle (\phi _{i},\{\phi _{1},\ldots ,\phi _{i-1}\})\in {\mathcal {T}}} .
All proper scoring rules are equal to weighted sums (integral with a non-negative weighting functional) of the losses in a set of simple two-alternative decision problems that use the probabilistic prediction, each such decision problem having a particular combination of associated cost parameters for false positive and false negative decisions. A strictly proper scoring rule corresponds to having a nonzero weighting for all possible decision thresholds. Any given proper scoring rule is equal to the expected losses with respect to a particular probability distribution over the decision thresholds; thus the choice of a scoring rule corresponds to an assumption about the probability distribution of decision problems for which the predicted probabilities will ultimately be employed, with for example the quadratic loss (or Brier) scoring rule corresponding to a uniform probability of the decision threshold being anywhere between zero and one. The classification accuracy score (percent classified correctly), a single-threshold scoring rule which is zero or one depending on whether the predicted probability is on the appropriate side of 0.5, is a proper scoring rule but not a strictly proper scoring rule because it is optimized (in expectation) not only by predicting the true probability but by predicting any probability on the same side of 0.5 as the true probability.
A strictly proper scoring rule, whether binary or multiclass, after an affine transformation remains a strictly proper scoring rule. That is, if S ( r , i ) {\displaystyle S(\mathbf {r} ,i)} is a strictly proper scoring rule then a + b S ( r , i ) {\displaystyle a+bS(\mathbf {r} ,i)} with b ≠ 0 {\displaystyle b\neq 0} is also a strictly proper scoring rule, though if b < 0 {\displaystyle b<0} then the optimization sense of the scoring rule switches between maximization and minimization.
A proper scoring rule is said to be local if its estimate for the probability of a specific event depends only on the probability of that event. This statement is vague in most descriptions but we can, in most cases, think of this as the optimal solution of the scoring problem "at a specific event" is invariant to all changes in the observation distribution that leave the probability of that event unchanged. All binary scores are local because the probability assigned to the event that did not occur is determined so there is no degree of flexibility to vary over.
Affine functions of the logarithmic scoring rule are the only strictly proper local scoring rules on a finite set that is not binary.
The expectation value of a proper scoring rule S {\displaystyle S} can be decomposed into the sum of three components, called uncertainty, reliability, and resolution, which characterize different attributes of probabilistic forecasts:
If a score is proper and negatively oriented (such as the Brier Score), all three terms are positive definite. The uncertainty component is equal to the expected score of the forecast which constantly predicts the average event frequency. The reliability component penalizes poorly calibrated forecasts, in which the predicted probabilities do not coincide with the event frequencies.
The equations for the individual components depend on the particular scoring rule. For the Brier Score, they are given by
where x ¯ {\displaystyle {\bar {x}}} is the average probability of occurrence of the binary event x {\displaystyle x} , and π ( p ) {\displaystyle \pi (p)} is the conditional event probability, given p {\displaystyle p} , i.e. π ( p ) = P ( x = 1 ∣ p ) {\displaystyle \pi (p)=P(x=1\mid p)}