
In binary classification, we want to make as few incorrect predictions as possible. The 0–1 loss records each mistake: it is 1 for an incorrect prediction and 0 for a correct one. With true label and prediction , we define it as
In indicator notation, we can write this as
We take , where is a measurable score function: it maps the input features to a real number whose sign determines the predicted class. Throughout this note, we predict when the score is zero, so for and otherwise.
For a nonzero score, a positive product indicates a correct prediction and a negative product indicates a mistake. At a zero score, correctness depends on the label and our tie-breaking rule. Defining the margin , we therefore have the bound
The inequality becomes equality whenever the score is nonzero. The margin-based indicator counts every zero score as an error; the actual classification loss uses the fixed tie-breaking rule above.
The 0–1 loss measures classification error, but changing a score without changing its sign leaves the loss unchanged. This makes direct optimization difficult. A surrogate loss replaces it with a criterion that changes more usefully with the score. We must then check whether minimizing its population risk, the average loss over the data distribution, preserves the desired classification decision.
The Role of Surrogate Loss Functions
Surrogate losses replace the 0–1 loss with a criterion that is easier to optimize. The examples below are convex in the margin, although not all are smooth: the hinge loss has a corner. We first compare their forms, then examine when minimizing their expected risks preserves the desired classification rule.
- Hinge Loss: , used in support vector machines.
- Exponential Loss: , used in AdaBoost.
- Logistic Loss: , used in logistic regression.
- Truncated Quadratic Loss: , which is quadratic below its threshold and zero above it.
In these expressions, is the margin: the product of the true label and the score . Its sign records whether the score agrees with the label.
Why Convexity Matters
Convexity helps explain the computational appeal of these losses: a local minimum of a convex function is also a global minimum. We check convexity in the scalar margin below. Whether the full fitting problem is convex also depends on how the score function is parameterized.
1. Hinge Loss
Defined as
the hinge loss is the pointwise maximum of the linear function and the constant function 0. We can break this down further:
-
Piecewise Definition:
For , we have , and for , . -
Convexity Criterion:
A function that is the maximum of two convex functions is itself convex. Here, the constant function 0 is convex, and is an affine (linear) function, which is convex. Thus, their pointwise maximum, , is convex. -
Conclusion:
Hence, is convex.
2. Exponential Loss
With the form
the exponential loss is smooth. Its second derivative also establishes strict convexity:
-
First Derivative:
-
Second Derivative:
-
Positivity of Second Derivative:
Since for all real , it follows thatwhich implies that is strictly convex.
3. Logistic Loss
The logistic loss is given by
As with the exponential loss, we can establish strict convexity by differentiating twice:
-
First Derivative:
Let . Then,Hence,
-
Second Derivative:
Differentiating again,A systematic approach is to set (so that ) and apply the quotient rule. This yields:
-
Positivity of Second Derivative:
Since both and are positive for all , we have:confirming that is strictly convex.
The standard logistic loss evaluates to at , below the value 1 of the margin-based 0–1 loss. Multiplying it by the positive constant makes its value equal to 1 at without changing the minimizer of the surrogate risk. This scaling makes the logistic loss an upper bound on the 0–1 loss; preserving the minimizer and providing a pointwise upper bound are distinct properties.
4. Truncated Quadratic Loss
Often defined as
this loss uses a quadratic penalty for and assigns zero loss when . Its convexity follows from its slope: the derivative of increases to zero at the joining point, then remains zero on the flat part. Equivalently, it is the squared hinge loss, .
Fisher Consistency, Bridging Surrogate Losses and the 0,1 Loss
Convexity answers an optimization question, not whether the resulting decisions are correct. Fisher consistency asks whether a population surrogate-risk minimizer gives a Bayes-optimal classification rule. It does not by itself show that a finite-sample fit reaches that population minimum.
Let , with , and write for the distribution of the features alone. Population risks average over the joint distribution, with the candidate score held fixed. At a fixed , we average only over , with and . We write these expectations as , or once the distribution is clear. Under the 0,1 loss, the Bayes classifier chooses the more likely label:
When we define the surrogate risk as
We minimize over all measurable real-valued score functions, rather than a restricted model class. Whenever a minimizer of exists, Fisher consistency requires that it satisfies, almost surely,
Thus, a population surrogate-risk minimizer makes the Bayes-optimal decision wherever one class is more likely than the other. To obtain a corresponding result for a learned classifier, we would also need to control estimation, approximation, and optimization errors.
Surrogate Losses as Upper Bounds
Some surrogate losses also upper-bound the 0–1 loss pointwise; the logistic loss does so after the scaling described above. We distinguish that upper-bound property from the stronger question of how excess surrogate risk controls excess classification risk. Recall the margin-based 0–1 loss
and the surrogate risk for a classifier is given by
where is a nonnegative surrogate loss, finite at zero. The actual classification risk is bounded above by the expectation of , including at score ties. Convexity is useful for optimization but is not part of the definition of calibration.
Classification Calibration:
Classification calibration requires a positive conditional-risk gap between the best score and any score with the wrong sign. A consequence is that, for every , there is a such that every measurable score function satisfies
where
is the misclassification error, is the Bayes risk, and is the surrogate risk. Here , with the infimum over all measurable scores. The conditional-gap definition and its excess-risk consequence are developed by Bartlett, Jordan, and McAuliffe, Section 2.
To examine the corresponding population decisions at a given , define the conditional surrogate risk as
with . For a classification-calibrated loss , an attained conditional-risk minimum must give the correct sign whenever the classes are not equally likely. In particular, for every with , any minimizer of the conditional risk
satisfies
More precisely, for a generic conditional class probability and score , define
The calibration condition is whenever : a wrong-sign or zero score must have strictly larger conditional risk than the best achievable risk. This definition also covers losses whose risks approach their infimum without reaching it at a finite score.
The excess-risk inequality explains how calibration controls classifiers whose surrogate risks approach the optimum:
The inequality
tells us that a misclassification error at least above the Bayes risk forces the surrogate risk to remain at least above its optimum. Because is positive for every , sufficiently small excess surrogate risk rules out any fixed positive gap in classification risk. In particular, when converges to , the excess classification risk must converge to zero. This does not mean that each individual decrease in surrogate risk produces a decrease in classification error.
Fisher consistency therefore concerns the decisions made by population risk minimizers: their signs agree with when one class is more likely. The displayed calibration inequality also controls near-optimal surrogate risks. Both statements concern population risks; neither alone guarantees that a numerical fitting procedure reaches those risks.
Recap: Why conditioning reduces the risk calculation
The conditional-expectation note gives the tower property. For a fixed score and an integrable loss under the joint law ,
At a fixed feature value, only the label is averaged and the candidate score is a scalar. This is why the hinge and logistic calculations below minimize a conditional risk before identifying the population decision.
Mathematical Demonstration for Hinge Loss
The hinge loss is defined as
which can be written in piecewise form as
For a fixed , define the conditional risk associated with a surrogate loss as
where and .
First consider scores outside . The conditional risk is for and for . Moving toward the nearest endpoint never increases either expression, so a minimizer can always be chosen inside . On that interval,
- , because ; and
- , because .
Then the conditional risk becomes:
On this interval, the coefficient of the score determines which endpoint minimizes :
- If , then , so is a decreasing function of . Its minimum over is achieved at .
- If , then , so is an increasing function of . Its minimum is achieved at .
- If , then for every , so every score in that interval minimizes the risk.
Thus, when the classes are not equally likely, one valid choice of minimizer is
Taking the sign for , we obtain
which is the Bayes-optimal decision rule. At , either predicted class is Bayes optimal. The conditional minimum is , whereas the best wrong-sign or zero score has risk . Their gap is whenever , verifying calibration as well as the sign of a minimizer.
Mathematical Demonstration for Logistic Loss
The logistic loss is defined as
For a fixed , define the conditional risk associated with a surrogate loss as
where and .
For the logistic loss, this becomes
For a conditional class probability strictly between zero and one, the conditional risk is strictly convex. We therefore find its unique finite minimizer by differentiating with respect to and setting the derivative equal to zero.
-
Differentiate the first term:
The derivative of with respect to is -
Differentiate the second term:
Similarly, the derivative of with respect to is
Thus, the derivative of the conditional risk is
Setting , we obtain
Writing both fractions with a common denominator and solving for the score gives
Now, observe the sign of :
- If , then , so .
- If , then , so .
- If , then .
Thus,
which gives a Bayes-optimal decision, using our positive-label tie convention at .
The minimizing logistic score has the Bayes-optimal sign whenever the two classes have different probabilities. At conditional class probabilities zero or one, the same decision is approached as the score tends to the corresponding infinite limit; no finite score attains the infimum.
Visual Interpretation
The plot above compares the surrogate curves with the 0–1 step function, which is discontinuous at :
- Hinge Loss: Defined as , this curve decreases linearly as the margin increases through and is 0 for .
- Exponential Loss: Given by , this smooth curve decays exponentially as increases, thereby penalizing misclassified examples with a low margin quite heavily.
- Standard Logistic Loss: This is expressed as . At , it evaluates to , below the 0–1 loss value of 1. Multiplication by a positive constant preserves its risk minimizer; this follows from the scaling itself, rather than from classification calibration.
- Scaled Logistic Loss: To obtain a curve that upper-bounds the 0–1 loss, we scale the logistic loss by . The resulting loss, attains the value 1 at and is at least the 0–1 loss for . Its pointwise upper bound also yields an upper bound on the misclassification error ( ).
- Truncated Quadratic Loss: Defined as for and 0 for , this loss combines a quadratic penalty with a truncation to avoid excessive punishment for high-margin points.
The standard logistic loss lies below the 0–1 loss at , yet its population minimizer still gives the desired classification decision. Scaling adds a pointwise upper bound without changing that minimizer. The distinction matters: an upper bound compares the values of two losses, whereas consistency and calibration concern the decisions obtained by minimizing risk.
Key Takeaways:
- The optimization problem: The 0–1 loss directly measures classification mistakes, but its discontinuity and nonconvexity make it difficult to optimize.
- The surrogate choice: Hinge, exponential, logistic, and truncated quadratic losses are convex in the margin. Smoothness is a separate property; in particular, the hinge loss is not differentiable at its corner.
- The population target: Fisher consistency asks whether a population surrogate-risk minimizer gives a Bayes-optimal decision. Calibration additionally controls excess classification risk through excess surrogate risk.
- The upper bound: Scaling can provide a pointwise bound, as when multiplying the logistic loss by . That bound alone does not establish consistency or calibration.
- The fitted classifier: A population guarantee does not remove the need to control estimation, approximation, and numerical optimization errors when learning from data.
Choosing a surrogate involves two questions: can we optimize it, and does its population objective preserve the decision we want? Convexity helps with the first question; consistency and calibration address the second. Keeping these roles separate lets us use a convenient loss without mistaking computational convenience for a statistical guarantee.
