Tutorials › Statistical Learning (Graduate) › Hinge, Logistic, and Exponential Guarantees Compared

Surrogate Losses and Calibration · Tutorial 528 of 989

Hinge, Logistic, and Exponential Guarantees Compared

Compare the classification-regret guarantees of three standard margin losses and distinguish those guarantees from the behavior of their optimization objectives.

Advanced 11 min read

What You'll Learn

  • Define the conditional calibration function using the constrained wrong-sign infimum.
  • Derive the hinge, logistic, and exponential calibration functions.
  • Compare their guarantees for small conditional classification regret.
  • Calculate conditional score minimizers for each loss, including boundary cases.
  • Translate a surrogate excess-risk bound into a classification-regret bound.
  • Distinguish a calibration guarantee from an optimization or implementation claim.

What the Comparison Measures

Hinge, logistic, and exponential losses are all used to fit real-valued classification scores, but their guarantees are not interchangeable. A calibration function quantifies how much surrogate excess risk is forced by a score that points to the wrong class. Comparing these functions tells us how strongly each loss penalizes mistakes near the decision boundary. It does not, by itself, tell us how quickly an algorithm finds a good score or which loss is easiest to implement.

Let \(Y\in\{-1,+1\}\), let \(\eta=P(Y=+1\mid X=x)\) at a fixed covariate value, and let \(\alpha\in\mathbb R\) be a candidate score. For a margin loss \(\phi\), its conditional surrogate risk is \(C_\eta(\alpha)=\eta\phi(\alpha)+(1-\eta)\phi(-\alpha)\). The corresponding conditional zero-one risk is minimized by predicting the more probable class. Write \(\theta=|2\eta-1|\), the size of the conditional class imbalance. By symmetry, calculations can be made with \(\eta=(1+\theta)/2\) and a score \(\beta\) oriented toward the more probable class.

Definition: For \(0\leq\theta\leq1\), define the calibration function $$ \delta_\phi(\theta) = \inf_{\beta\leq0} C_\theta(\beta) - \inf_{\beta\in\mathbb R} C_\theta(\beta), \qquad C_\theta(\beta) = \frac{1+\theta}{2}\phi(\beta) + \frac{1-\theta}{2}\phi(-\beta). $$ The constraint \(\beta\leq0\) includes a score at zero: it is the constrained infimum for a wrong-sign score, using a conservative convention at a tie. The calibration function is the least conditional surrogate excess risk compatible with that constraint.

For the three losses considered here, \(\phi_{\rm H}(t)=(1-t)_+\), \(\phi_{\rm L}(t)=\log(1+e^{-t})\), and \(\phi_{\rm E}(t)=e^{-t}\). The next derivation gives their calibration functions from the definition rather than treating the formulas as black boxes.

Deriving the Three Calibration Functions

For hinge loss, on \(-1\leq\beta\leq1\) the conditional risk is \(1-\theta\beta\). When \(\beta\leq0\), this is at least \(1\), and outside that interval the risk cannot be smaller. Thus its constrained infimum is \(1\). The unrestricted infimum is \(1-\theta\), attained at \(\beta=1\) when \(\theta>0\), so \(\delta_{\rm H}(\theta)=\theta\).

For logistic loss, differentiating the conditional risk shows that its unrestricted minimum occurs at \(\beta=\log((1+\theta)/(1-\theta))\) for \(0\leq\theta<1\). The minimum value is the binary entropy \(H((1+\theta)/2)\), where \(H(p)=-p\log p-(1-p)\log(1-p)\). For \(\theta>0\), the derivative at zero is negative. Convexity therefore makes zero the constrained minimizer over \(\beta\leq0\), with risk \(\log 2\). At \(\theta=0\), both infima agree. Hence \(\delta_{\rm L}(\theta)=\log 2-H((1+\theta)/2)\).

For exponential loss, the conditional risk is \(\frac{1+\theta}{2}e^{-\beta}+\frac{1-\theta}{2}e^\beta\). For \(\theta>0\), its derivative at zero is \(-\theta\); convexity makes zero the constrained minimizer, with risk \(1\). The unrestricted minimum, for \(0\leq\theta<1\), is attained where the derivative vanishes and has value \(\sqrt{1-\theta^2}\). Consequently, \(\delta_{\rm E}(\theta)=1-\sqrt{1-\theta^2}\). At \(\theta=1\), the unrestricted infimum is zero, approached as \(\beta\) tends to infinity; the same formula still applies.

Theorem: On \(0\leq\theta\leq1\), the calibration functions are $$ \delta_{\rm H}(\theta)=\theta,\qquad \delta_{\rm L}(\theta)=\log 2-H\!\left(\frac{1+\theta}{2}\right),\qquad \delta_{\rm E}(\theta)=1-\sqrt{1-\theta^2}. $$ Proof: For hinge loss, the piecewise-linear conditional risk has constrained infimum \(1\) and unrestricted infimum \(1-\theta\), as shown above. For logistic loss, its constrained infimum is \(\log 2\), while substituting the unrestricted minimizer gives the binary entropy value. For exponential loss, its constrained infimum is \(1\); substituting the unrestricted minimizer gives \(\sqrt{1-\theta^2}\). Subtracting each unrestricted infimum from its constrained infimum gives the stated formulas. At \(\theta=0\), every difference is zero; at \(\theta=1\), the logistic and exponential unrestricted values are interpreted as infima. \(\square\)

Worked Example: Comparing Calibration at a Fixed Imbalance

Suppose \(\eta=0.75\). Then \(\theta=|2(0.75)-1|=0.5\). The conditional zero-one regret from predicting the less probable class is \(0.5\). Calculate the calibration function for each loss.

Hinge. The formula gives \(\delta_{\rm H}(0.5)=0.5\).

Logistic. Here \(H(0.75)=-0.75\log(0.75)-0.25\log(0.25)\approx0.562335\). Therefore \(\delta_{\rm L}(0.5)=\log 2-H(0.75)\approx0.693147-0.562335=0.130812\).

Exponential. We obtain \(\delta_{\rm E}(0.5)=1-\sqrt{1-0.5^2}=1-\sqrt{0.75}\approx0.133975\).

At this imbalance, a wrong-sign score must incur at least \(0.5\) hinge excess risk, compared with about \(0.131\) logistic excess risk and \(0.134\) exponential excess risk. These are guarantees in each loss's own scale; the numbers are not direct measures of practical performance.

Near the Decision Boundary

A small \(\theta\) means the two conditional class probabilities are close. The calibration functions behave differently in this regime. Hinge calibration is linear, whereas logistic and exponential calibration are quadratic to leading order.

Result: As \(\theta\) tends to zero from above, $$ \delta_{\rm H}(\theta)=\theta,\qquad \delta_{\rm L}(\theta)=\frac{\theta^2}{2}+\frac{\theta^4}{12}+O(\theta^6),\qquad \delta_{\rm E}(\theta)=\frac{\theta^2}{2}+\frac{\theta^4}{8}+O(\theta^6). $$ In particular, for \(0\leq\theta\leq1\), \(\delta_{\rm L}(\theta)\geq\theta^2/2\) and \(\delta_{\rm E}(\theta)\geq\theta^2/2\).

Derivation. Differentiating the logistic formula gives \(\delta_{\rm L}'(\theta)=\tfrac12\log((1+\theta)/(1-\theta))\), so \(\delta_{\rm L}''(\theta)=1/(1-\theta^2)\). The Taylor expansion of the second derivative at zero is \(1+\theta^2+\theta^4+\cdots\). Integrating twice and using \(\delta_{\rm L}(0)=\delta_{\rm L}'(0)=0\) gives the displayed logistic expansion. Also, \(\delta_{\rm L}'(\theta)=\int_0^\theta(1-t^2)^{-1}\,dt\geq\theta\), so integrating once more gives \(\delta_{\rm L}(\theta)\geq\theta^2/2\).

For exponential loss, the Taylor expansion of \((1-\theta^2)^{1/2}\) gives \(1-\sqrt{1-\theta^2}=\theta^2/2+\theta^4/8+O(\theta^6)\). For the stated lower bound, put \(u=\theta^2\). Since \(\sqrt{1-u}\leq1-u/2\) for \(0\leq u\leq1\) (squaring the nonnegative right-hand side verifies this inequality), \(1-\sqrt{1-u}\geq u/2\). Hinge calibration is exactly linear, so it needs no approximation.

Worked Example: A Small Boundary Imbalance

Take \(\theta=0.1\), so the more probable class has conditional probability \(0.55\). Then the three calibration values are \(\delta_{\rm H}(0.1)=0.1\), \(\delta_{\rm L}(0.1)=\log 2-H(0.55)\approx0.005008\), and \(\delta_{\rm E}(0.1)=1-\sqrt{0.99}\approx0.005013\).

The logistic value can be checked directly: \(H(0.55)\approx0.688139\), and \(0.693147-0.688139\approx0.005008\). For exponential loss, \(\sqrt{0.99}\approx0.994987\), giving \(1-0.994987\approx0.005013\). Thus the same wrong-sign score is required to incur much less surrogate excess when the imbalance is small under logistic or exponential loss than under hinge loss. This is the quadratic-versus-linear distinction, not a statement that either quadratic loss is better for every task.

Conditional Score Minimizers

Calibration describes the cost of a wrong-sign score; it does not specify where the conditional risk is minimized. The minimizers also differ in scale and shape.

Result: For \(0<\eta<1\), conditional-risk minimizers are:
  • Hinge: \(\alpha=1\) if \(\eta>1/2\), \(\alpha=-1\) if \(\eta<1/2\), and every \(\alpha\in[-1,1]\) if \(\eta=1/2\).
  • Logistic: \(\alpha=\log(\eta/(1-\eta))\).
  • Exponential: \(\alpha=\tfrac12\log(\eta/(1-\eta))\).
For \(\eta=1\) or \(0\), logistic and exponential conditional risks have infimum zero only as the score tends to \(+\infty\) or \(-\infty\), respectively; no finite minimizer exists.

Verification. For hinge loss and \(-1\leq\alpha\leq1\), the conditional risk equals \(1-(2\eta-1)\alpha\). If \(\eta>1/2\), it decreases up to \(\alpha=1\); for \(\alpha>1\), it equals \((1-\eta)(1+\alpha)\), which increases. Thus \(1\) is the minimizer. The case \(\eta<1/2\) follows by reflecting \(\alpha\), and at \(\eta=1/2\) the risk is constant on \([-1,1]\) and larger outside it.

For logistic loss, differentiating gives \(C_\eta'(\alpha)=-\eta/(1+e^\alpha)+(1-\eta)/(1+e^{-\alpha})\). Setting this equal to zero yields \(e^\alpha=\eta/(1-\eta)\). The second derivative is positive for finite \(\alpha\), so this is the unique minimizer. For exponential loss, setting \(C_\eta'(\alpha)=-\eta e^{-\alpha}+(1-\eta)e^\alpha=0\) gives \(e^{2\alpha}=\eta/(1-\eta)\); its positive second derivative establishes the stated unique minimizer. At \(\eta=0\) or \(1\), direct substitution shows the infimum is approached only in the indicated infinite-score limit.

Worked Example: Comparing the Minimizing Scores

Return to \(\eta=0.75\). The hinge minimizer is \(\alpha=1\). The logistic minimizer is \(\log(0.75/0.25)=\log 3\approx1.099\), and the exponential minimizer is \(\tfrac12\log 3\approx0.549\).

Their conditional minimum risks are also different. Hinge risk at \(\alpha=1\) is \(0.75(0)+0.25(2)=0.5\). Logistic risk at \(\log 3\) is the entropy \(H(0.75)\approx0.562335\). Exponential risk at \(\tfrac12\log 3\) is \(0.75/\sqrt{3}+0.25\sqrt{3}=\sqrt{0.75}\approx0.866025\). These risk values are measured on different loss scales; their absolute sizes do not rank the losses.

From Calibration to a Regret Guarantee

The conditional calibration functions yield a population guarantee. Let \(\eta(X)=P(Y=+1\mid X)\), let \(f(X)\) be a measurable score, and let \(R_\phi(f)=E[\phi(Yf(X))]\). Suppose the relevant risks are finite, and define the optimal surrogate risk as \(R_\phi^*=E[\inf_\alpha C_{\eta(X)}(\alpha)]\). The conditional classification regret is \(\theta(X)=|2\eta(X)-1|\) when \(f(X)\) points to the wrong class, and zero otherwise; a zero score may conservatively be counted as wrong when \(\theta(X)>0\).

Theorem: For each of the three losses, $$ \delta_\phi\!\left(E[\text{conditional classification regret}]\right) \leq R_\phi(f)-R_\phi^*. $$ Consequently, if the surrogate excess risk is at most \(\varepsilon\), then the expected classification regret is at most \(\delta_\phi^{-1}(\varepsilon)\), with the inverse restricted to the range of the calibration function.

Proof. At each \(X=x\), if the score has the wrong sign, the definition of \(\delta_\phi\) bounds its conditional surrogate excess risk below by \(\delta_\phi(\theta(x))\). If it has the correct sign, its conditional excess risk is nonnegative and the conditional classification regret is zero. Hence the conditional surrogate excess is at least \(\delta_\phi(r(x))\), where \(r(x)\) denotes conditional classification regret. Integrating gives \(R_\phi(f)-R_\phi^*\geq E[\delta_\phi(r(X))]\). Each calibration function above is convex on \([0,1]\): hinge is linear, logistic has second derivative \(1/(1-\theta^2)>0\) on \((0,1)\), and exponential has second derivative \((1-\theta^2)^{-3/2}>0\) there. Continuity extends convexity to the endpoints. Jensen's inequality now gives \(E[\delta_\phi(r(X))]\geq\delta_\phi(E[r(X)])\). Since each function is increasing, inverting yields the claim. \(\square\)

Worked Example: Interpreting a Small Excess-Risk Bound

Suppose a fitted score has surrogate excess risk at most \(0.01\). For hinge loss, \(\delta_{\rm H}^{-1}(0.01)=0.01\), so the expected classification regret is at most \(0.01\). For logistic and exponential loss, the lower bounds \(\delta_\phi(\theta)\geq\theta^2/2\) imply that expected classification regret is at most \(\sqrt{2(0.01)}\approx0.1414\).

These are valid worst-case bounds, not predictions of the actual regret. The comparison shows that calibration alone gives a tighter small-\(\varepsilon\) bound for hinge loss. It does not prove that hinge fitting will produce a smaller empirical error, a better-calibrated probability, or a more stable fitted model.

Regret Guarantees Are Not Optimization Guarantees

Calibration answers a statistical question: how much surrogate excess risk must accompany a wrong classification decision? It does not answer how quickly an optimization procedure reduces empirical risk, how sensitive its solution is to regularization, or how well its model class represents the conditional minimizer. Those questions involve the objective, the data, the model class, and the algorithm.

The losses do differ in optimization-relevant properties. Hinge loss is convex but has a kink at margin \(1\). Logistic loss is smooth, and its derivative with respect to the margin has magnitude at most \(1\). Exponential loss is smooth too, but its derivative magnitude \(e^{-t}\) grows without bound for very negative margins, so badly misclassified observations can exert large influence. These facts may matter when selecting numerical methods or diagnosing a fit, but none follows from comparing calibration functions. Likewise, the conditional minimizers describe unrestricted pointwise optima; a restricted model or a penalty can yield different fitted scores.

Common Mistake

  • Wrong reasoning: “Hinge has the largest calibration value, so hinge optimization is always faster and its fitted predictions are always better.”
  • Correction: A calibration value is a lower bound on conditional surrogate excess under a wrong-sign constraint. It can be used to transfer an excess-risk guarantee to classification regret. It is not an algorithmic convergence rate or a universal empirical-performance ranking.
  • Another pitfall: Comparing raw minimum conditional risks across losses. The losses use different scales, so a smaller minimum value does not mean a better classifier or a stronger guarantee.
Key takeaway: Hinge calibration is linear near the boundary; logistic and exponential calibration are quadratic with the same leading coefficient. Their conditional minimizers have different score scales, and neither calibration nor minimizer formulas alone determine optimization performance.

Check Your Understanding

Try these questions using the definitions and calculations above.

  1. For \(\theta=0.4\), write the hinge calibration value and the exact expressions for the logistic and exponential calibration values.
  2. Why does the calibration definition constrain the score to \(\beta\leq0\), rather than only \(\beta<0\)?
  3. At \(\eta=0.8\), calculate the logistic and exponential conditional minimizing scores.
  4. What near-zero distinction separates hinge calibration from logistic and exponential calibration?
  5. Give one optimization-relevant property of exponential loss that is not itself a calibration guarantee.
  6. If surrogate excess risk is at most \(\varepsilon\), what bound follows for expected classification regret under hinge loss?
Clinical Biostats