In mathematical optimization, statistics, decision theory and machine learning, a loss function or cost function is a function that maps an event or values of one or more variables onto a real number intuitively representing some "cost" associated with the event. An optimization problem seeks to minimize a loss function. An objective function is either a loss function or its negative (sometimes called a reward function, a profit function, a utility function, a fitness function, etc.), in which case it is to be maximized.
In statistics, typically a loss function is used for parameter estimation, and the event in question is some function of the difference between estimated and true values for an instance of data. The concept, as old as Laplace, was reintroduced in statistics by Abraham Wald in the middle of the 20th century.^{[1]} In the context of economics, for example, this is usually economic cost or regret. In classification, it is the penalty for an incorrect classification of an example. In actuarial science, it is used in an insurance context to model benefits paid over premiums, particularly since the works of Harald Cramér in the 1920s.^{[2]} In optimal control the loss is the penalty for failing to achieve a desired value. In financial risk management the function is precisely mapped to a monetary loss.
Contents

Use in statistics 1

Expected loss 2

Frequentist expected loss 2.1

Bayesian expected loss 2.2

Economic choice under uncertainty 2.3

Examples 2.4

Decision rules 3

Selecting a loss function 4

Loss functions in Bayesian statistics 5

Regret 6

Quadratic loss function 7

01 loss function 8

See also 9

References 10

Further reading 11
Use in statistics
Parameter estimation for supervised learning tasks such as regression or classification can be formulated as the minimization of a loss function over a training set. The goal of estimation is to find a function that models its input well: if it were applied to the training set, it should predict the values (or class labels) associated with the samples in that set. The loss function quantifies the amount by which the prediction deviates from the actual values.
Definition
Formally, we begin by considering some family of distributions for a random variable X, that is indexed by some θ.
More intuitively, we can think of X as our "data", perhaps X=(X_1,\ldots,X_n), where X_i\sim F_\theta i.i.d. The X is the set of things the decision rule will be making decisions on. There exists some number of possible ways F_\theta to model our data X, which our decision function can use to make decisions. For a finite number of models, we can thus think of θ as the index to this family of probability models. For an infinite family of models, it is a set of parameters to the family of distributions.
On a more practical note, it is important to understand that, while it is tempting to think of loss functions as necessarily parametric (since they seem to take θ as a "parameter"), the fact that θ is infinitedimensional is completely incompatible with this notion; for example, if the family of probability functions is uncountably infinite, θ indexes an uncountably infinite space.
From here, given a set A of possible actions, a decision rule is a function δ : \scriptstyle\mathcal{X}→ A.
A loss function is a real lowerbounded function L on Θ × A for some θ ∈ Θ. The value L(θ, δ(X)) is the cost of action δ(X) under parameter θ.^{[3]}
Expected loss
The value of the loss function itself is a random quantity because it depends on the outcome of a random variable X. Both frequentist and Bayesian statistical theory involve making a decision based on the expected value of the loss function: however this quantity is defined differently under the two paradigms.
Frequentist expected loss
We first define the expected loss in the frequentist context. It is obtained by taking the expected value with respect to the probability distribution, P_{θ}, of the observed data, X. This is also referred to as the risk function^{[4]} ^{[5]}^{[6]}^{[7]} of the decision rule δ and the parameter θ. Here the decision rule depends on the outcome of X. The risk function is given by^{[8]}

R(\theta, \delta) = \mathbb{E}_\theta L\big( \theta, \delta(X) \big) = \int_X L\big( \theta, \delta(x) \big) \, \operatorname{d} P_\theta (x) .
Bayesian expected loss
In a Bayesian approach, the expectation is calculated using the posterior distribution π^{*} of the parameter θ:

\rho(\pi^*,a) = \int_\Theta L(\theta, a) \, \operatorname{d} \pi^* (\theta).
One then should choose the action a^{*} which minimises the expected loss. Although this will result in choosing the same action as would be chosen using the frequentist risk, the emphasis of the Bayesian approach is that one is only interested in choosing the optimal action under the actual observed data, whereas choosing the actual Bayes optimal decision rule, which is a function of all possible observations, is a much more difficult problem.
Economic choice under uncertainty
In economics, decisionmaking under uncertainty is often modelled using the von NeumannMorgenstern utility function of the uncertain variable of interest, such as endofperiod wealth. Since the value of this variable is uncertain, so is the value of the utility function; it is the expected value of utility that is maximized.
Examples

For a scalar parameter θ, a decision function whose output \hat\theta is an estimate of θ, and a quadratic loss function


L(\theta,\hat\theta)=(\theta\hat\theta)^2,

the risk function becomes the mean squared error of the estimate,


R(\theta,\hat\theta)=E_\theta(\theta\hat\theta)^2.


L(f,\hat f)=\f\hat f\_2^2\,,

the risk function becomes the mean integrated squared error


R(f,\hat f)=E \f\hat f\^2.\,
Decision rules
A decision rule makes a choice using an optimality criterion. Some commonly used criteria are:

Minimax: Choose the decision rule with the lowest worst loss — that is, minimize the worstcase (maximum possible) loss:


\underset{\delta} {\operatorname{arg\,min}} \ \max_{\theta \in \Theta} \ R(\theta,\delta).

Invariance: Choose the optimal decision rule which satisfies an invariance requirement.

Choose the decision rule with the lowest average loss (i.e. minimize the expected value of the loss function):


\underset{\delta} {\operatorname{arg\,min}} \ \mathbb{E}_{\theta \in \Theta} [R(\theta,\delta)] = \underset{\delta} {\operatorname{arg\,min}} \ \int_{\theta \in \Theta} R(\theta,\delta) \, p(\theta) \,d\theta.
Selecting a loss function
Sound statistical practice requires selecting an estimator consistent with the actual acceptable variation experienced in the context of a particular applied problem. Thus, in the applied use of loss functions, selecting which statistical method to use to model an applied problem depends on knowing the losses that will be experienced from being wrong under the problem's particular circumstances.^{[9]}
A common example involves estimating "location." Under typical statistical assumptions, the mean or average is the statistic for estimating location that minimizes the expected loss experienced under the squarederror loss function, while the median is the estimator that minimizes expected loss experienced under the absolutedifference loss function. Still different estimators would be optimal under other, less common circumstances.
In economics, when an agent is risk neutral, the objective function is simply expressed in monetary terms, such as profit, income, or endofperiod wealth.
But for riskaverse (or riskloving) agents, loss is measured as the negative of a utility function, which represents satisfaction and is usually interpreted in ordinal terms rather than in cardinal (absolute) terms.
Other measures of cost are possible, for example mortality or morbidity in the field of public health or safety engineering.
For most optimization algorithms, it is desirable to have a loss function that is globally continuous and differentiable.
Two very commonly used loss functions are the squared loss, L(a) = a^2, and the absolute loss, L(a)=a. However the absolute loss has the disadvantage that it is not differentiable at a=0. The squared loss has the disadvantage that it has the tendency to be dominated by outliers—when summing over a set of a's (as in \sum_{i=1}^n L(a_i) ), the final sum tends to be the result of a few particularly large avalues, rather than an expression of the average avalue.
The choice of a loss function is not arbitrary. It is very restrictive and sometimes the loss function may be characterized by its desirable properties.^{[10]} Among the choice principles are, for example, the requirement of completeness of the class of symmetric statistics in the case of i.i.d. observations, the principle of complete information, and some others.
Loss functions in Bayesian statistics
One of the consequences of Bayesian inference is that in addition to experimental data, the loss function does not in itself wholly determine a decision. What is important is the relationship between the loss function and the posterior probability. So it is possible to have two different loss functions which lead to the same decision when the prior probability distributions associated with each compensate for the details of each loss function.
Combining the three elements of the prior probability, the data, and the loss function then allows decisions to be based on maximizing the subjective expected utility, a concept introduced by Leonard J. Savage.
Regret
Savage also argued that using nonBayesian methods such as minimax, the loss function should be based on the idea of regret, i.e., the loss associated with a decision should be the difference between the consequences of the best decision that could have been taken had the underlying circumstances been known and the decision that was in fact taken before they were known.
Quadratic loss function
The use of a quadratic loss function is common, for example when using least squares techniques. It is often more mathematically tractable than other loss functions because of the properties of variances, as well as being symmetric: an error above the target causes the same loss as the same magnitude of error below the target. If the target is t, then a quadratic loss function is

\lambda(x) = C (tx)^2 \;
for some constant C; the value of the constant makes no difference to a decision, and can be ignored by setting it equal to 1.
Many common statistics, including ttests, regression models, design of experiments, and much else, use least squares methods applied using linear regression theory, which is based on the quadratric loss function.
The quadratic loss function is also used in linearquadratic optimal control problems. In these problems, even in the absence of uncertainty, it may not be possible to achieve the desired values of all target variables. Often loss is expressed as a quadratic form in the deviations of the variables of interest from their desired values; this approach is tractable because it results in linear firstorder conditions. In the context of stochastic control, the expected value of the quadratic form is used.
01 loss function
In statistics and decision theory, a frequently used loss function is the 01 loss function

L(\hat{y}, y) = I(\hat{y} \ne y), \,
where I is the indicator notation.
See also
References

^ Wald, A. (1950). Statistical Decision Functions. Wiley.

^ Cramér, H. (1930). On the mathematical theory of risk. Centraltryckeriet.

^ Nikulin, M.S. (2001), "Loss function", in Hazewinkel, Michiel,

^ Nikulin, M.S. (2001), "Risk of a statistical procedure", in Hazewinkel, Michiel,

^

^

^ Robert, Christian P. (2007). The Bayesian Choice (2nd ed.). New York: Springer.

^ Here,

θ is a fixed but possibly unknown state of nature;

X is a vector of observations stochastically drawn from a population;

{\mathbb E}_\theta is the expectation over all population values of X;

dP_{θ} is a probability measure over the event space of X, parametrized by θ; and

the integral is evaluated over the entire support of X.

^ Pfanzagl, J. (1994). Parametric Statistical Theory. Berlin: Walter de Gruyter.

^ Detailed information on mathematical principles of the loss function choice is given in Chapter 2 of the book Robust and NonRobust Models in Statistics by Lev B. Klebanov, Svetlozat T. Rachev and Frank J. Fabozzi, Nova Scientific Publishers, Inc. New York, 2009 (and references there).
Further reading

Aretz, Kevin; Bartram, Söhnke M.; Pope, Peter F. (April–June 2011). "Asymmetric Loss Functions and the Rationality of Expected Stock Returns". International Journal of Forecasting 27 (2): 413–437.

This article was sourced from Creative Commons AttributionShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, EGovernment Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a nonprofit organization.