Tutorials › Statistical Learning (Graduate) › Calibration Functions Near Zero

Surrogate Losses and Calibration · Tutorial 526 of 989

Calibration Functions Near Zero

Learn how the three calibration functions behave near zero and how that behavior determines the power converting surrogate excess risk into classification regret.

Advanced 12 min read

What You'll Learn

  • Define a calibration function through constrained and unrestricted conditional surrogate risks.
  • Derive the hinge, logistic, and exponential calibration functions.
  • Obtain and interpret their expansions near zero.
  • Distinguish linear from quadratic conditional regret conversion.
  • Relate the local powers to classification-rate exponents.
  • Check endpoint cases where logistic and exponential infima are not attained.

Why the Behavior Near Zero Matters

Calibration functions quantify how much conditional surrogate excess risk is forced by a classification error. Their behavior near zero is especially important: small classification regret corresponds to conditional class probabilities near the decision boundary, and the calibration function describes the surrogate cost in that regime. A function that grows linearly gives a different rate conversion from one that grows quadratically.

We compare three margin losses: hinge, logistic, and exponential. Write \(\eta=P(Y=1\mid X=x)\), \(\theta=2\eta-1\), and let \(u\in\mathbb R\) be a margin score. Thus \(\theta\in[-1,1]\), and the Bayes-optimal sign is the sign of \(\theta\). The analysis below uses \(t=|\theta|\), the magnitude of the conditional class imbalance.

Definition: For a margin loss \(\phi\), its conditional surrogate risk is \(C_\eta(u)=\eta\phi(u)+(1-\eta)\phi(-u)\). For \(t=|\theta|\), the calibration function is the least conditional excess surrogate risk among scores that fail to have the Bayes sign: \(\delta_\phi(t)=\inf_{\theta u\leq 0} C_\eta(u)-\inf_{u\in\mathbb R}C_\eta(u)\). The constraint includes \(u=0\). At \(t=0\), define \(\delta_\phi(0)=0\).

The definition uses infima rather than requiring minimizers. That distinction matters at \(\eta=0\) or \(\eta=1\): for logistic and exponential losses, the unrestricted infimum is approached as the score tends to an infinite value and is not attained at any finite score.

The Three Calibration Functions

For \(\theta\geq0\), the constrained scores satisfy \(u\leq0\); symmetry gives the same calibration function when \(\theta<0\). The three losses and their calibration functions are as follows.

Calibration functions: For hinge loss \(\phi_{\mathrm H}(u)=(1-u)_+\), \(\delta_{\mathrm H}(t)=t\). For logistic loss \(\phi_{\mathrm L}(u)=\log(1+e^{-u})\), \(\delta_{\mathrm L}(t)=\log 2+\frac{1+t}{2}\log\frac{1+t}{2}+\frac{1-t}{2}\log\frac{1-t}{2}\). For exponential loss \(\phi_{\mathrm E}(u)=e^{-u}\), \(\delta_{\mathrm E}(t)=1-\sqrt{1-t^2}\). These formulas hold for \(0\leq t\leq1\), with endpoint values interpreted through infima.

Here is the minimization behind the formulas. For the hinge loss, when \(\theta\geq0\), the unrestricted minimum is \(1-\theta\), attained at \(u=1\) (also at any \(u\geq1\) if \(\eta=1\)). On \(u\leq0\), the conditional risk is minimized at \(u=0\) and equals \(1\). Their difference is \(\theta\).

For logistic loss and \(0<\eta<1\), differentiating the conditional risk gives the finite minimizer \(u=\log(\eta/(1-\eta))\). Substitution gives the unrestricted minimum \(-\eta\log\eta-(1-\eta)\log(1-\eta)\). On \(u\leq0\), the risk is minimized at \(u=0\), with value \(\log2\), when \(\theta\geq0\). If \(\eta=1\), the unrestricted risk is \(\log(1+e^{-u})\): its infimum is \(0\) as \(u\to+\infty\), not an attained minimum. If \(\eta=0\), the symmetric statement holds as \(u\to-\infty\). Taking these infima yields the stated formula, including its endpoint values.

For exponential loss, the conditional risk is \(\eta e^{-u}+(1-\eta)e^u\). For \(0<\eta<1\), its unrestricted minimum occurs at \(u=\frac12\log(\eta/(1-\eta))\), with value \(2\sqrt{\eta(1-\eta)}=\sqrt{1-\theta^2}\). On \(u\leq0\) it is minimized at zero, with value \(1\), when \(\theta\geq0\). At \(\eta=1\), the risk is \(e^{-u}\), whose infimum is \(0\) as \(u\to+\infty\), but which has no finite minimizer; \(\eta=0\) is symmetric. Thus the endpoint calibration value is also given by the formula above.

Worked Example: Hinge Loss Gives Linear Conversion

Suppose the conditional class imbalance is \(\theta=0.08\), so that \(\eta=(1+\theta)/2=0.54\). A score with the wrong Bayes sign has conditional excess hinge risk at least \(\delta_{\mathrm H}(0.08)=0.08\).

The calculation is exact: the minimum constrained risk is \(1\), while the unrestricted minimum is \(1-\theta=0.92\). Their difference is \(1-0.92=0.08\). Thus, in this example, conditional classification regret \(0.08\) requires at least \(0.08\) conditional hinge excess risk.

Worked Example: Logistic Loss at a Small Imbalance

Take \(t=0.2\), which corresponds to \(\eta=0.6\). The exact logistic calibration value is \(\delta_{\mathrm L}(0.2)=\log2+0.6\log(0.6)+0.4\log(0.4)\).

Using \(\log2\approx0.693147\), \(\log(0.6)\approx-0.510826\), and \(\log(0.4)\approx-0.916291\), we obtain \(0.693147-0.306496-0.366516\approx0.020135\). The leading quadratic approximation is \(t^2/2=0.2^2/2=0.020000\), close to the exact value. The discrepancy is positive and small, as the higher-order terms in the expansion predict.

Worked Example: Exponential Loss at a Small Imbalance

For \(t=0.1\), the exponential calibration function is \(\delta_{\mathrm E}(0.1)=1-\sqrt{1-0.1^2}=1-\sqrt{0.99}\).

Since \(\sqrt{0.99}\approx0.9949874\), the exact value is approximately \(0.0050126\). The leading quadratic term is \(t^2/2=0.01/2=0.005\). The exact value exceeds that term by about \(0.0000126\), consistent with a positive fourth-order correction.

Expansions Near Zero

The hinge calibration function has no curvature to expand: it is exactly linear. Logistic and exponential calibration functions are smooth around zero and begin with a quadratic term. The following derivations identify both the leading powers and the next corrections.

Result: As \(t\to0\), \(\delta_{\mathrm H}(t)=t\), \(\delta_{\mathrm L}(t)=\frac{t^2}{2}+\frac{t^4}{12}+O(t^6)\), and \(\delta_{\mathrm E}(t)=\frac{t^2}{2}+\frac{t^4}{8}+O(t^6)\).

For logistic loss, differentiating its exact calibration formula for \(|t|<1\) gives \(\delta_{\mathrm L}'(t)=\frac12\log((1+t)/(1-t))\). The right side is \(\operatorname{artanh}(t)\), whose geometric-series expansion is \(t+t^3/3+t^5/5+\cdots\). Integrating from zero to \(t\), using \(\delta_{\mathrm L}(0)=0\), gives \(\delta_{\mathrm L}(t)=t^2/2+t^4/12+t^6/30+\cdots\). The power series converges for \(|t|<1\); in particular, truncating after the fourth-order term leaves a remainder \(O(t^6)\) near zero.

For exponential loss, apply the Taylor expansion of \(\sqrt{1-z}\) at \(z=0\): \(\sqrt{1-z}=1-z/2-z^2/8+O(z^3)\). Putting \(z=t^2\) gives \(1-\sqrt{1-t^2}=t^2/2+t^4/8+O(t^6)\). The hinge identity \(\delta_{\mathrm H}(t)=t\) needs no approximation. This proves the stated expansions. \(\square\)

From Local Powers to Regret-Rate Exponents

The conditional classification regret at a feature value is \(t\) when the score has the wrong Bayes sign, and zero otherwise. By the constrained-infimum definition, a wrong-sign score has conditional surrogate excess at least \(\delta_\phi(t)\). A correct-sign score has zero classification regret. Thus the calibration function converts a pointwise classification regret into a lower bound on surrogate excess.

This gives the general exponent rule. If \(\delta_\phi(t)\) behaves like \(c t^q\) near zero, with \(c>0\), then a small conditional surrogate excess \(\varepsilon\) permits classification regret of order \(\varepsilon^{1/q}\), not \(\varepsilon\), in the small-regret regime. For hinge loss \(q=1\); for logistic and exponential losses \(q=2\). This local rule can be made into a population bound here because the relevant calibration functions are convex on \([0,1]\).

Result: Let \(R\) be the population classification regret and \(S\) the population surrogate excess risk of a score rule. For these three losses, \(R\leq S\) for hinge loss, while \(R\leq\sqrt{2S}\) for logistic and exponential loss.

To justify the population statement, let \(R(x)\) denote the conditional classification regret. It is either zero or \(t(x)=|2\eta(x)-1|\). At every \(x\), the conditional surrogate excess is at least \(\delta_\phi(R(x))\): this follows from the constrained infimum when the score has the wrong sign, and from nonnegativity of excess risk when \(R(x)=0\). Taking expectations gives \(E[\delta_\phi(R(X))]\leq S\).

Each calibration function is convex on \([0,1]\). For hinge loss this is immediate. For \(0\leq t<1\), the second derivatives are \(\delta_{\mathrm L}''(t)=1/(1-t^2)>0\) and \(\delta_{\mathrm E}''(t)=1/(1-t^2)^{3/2}>0\); continuity extends convexity to the closed interval. Jensen's inequality therefore yields \(\delta_\phi(E[R(X)])\leq E[\delta_\phi(R(X))]\leq S\). For hinge, \(\delta_{\mathrm H}(R)=R\). For logistic, the series above has nonnegative terms and gives \(\delta_{\mathrm L}(R)\geq R^2/2\), with the endpoint following by continuity. For exponential, \(1-\sqrt{1-R^2}\geq R^2/2\), since \(\sqrt{1-z}\leq1-z/2\) for \(0\leq z\leq1\). These facts give the claimed inequalities. \(\square\)

Consequently, if a sequence of procedures has surrogate excess risk \(S_n=O(n^{-\alpha})\), these bounds give classification regret \(R_n=O(n^{-\alpha})\) for hinge loss and \(R_n=O(n^{-\alpha/2})\) for logistic and exponential loss. This is the rate-exponent distinction caused by linear versus quadratic calibration near zero. These bounds concern conversion from surrogate excess to classification regret; they do not by themselves establish how quickly a particular procedure achieves its surrogate-risk rate.

Common Pitfall

  • Confusing the expansion variable. The Taylor expansions are in \(t=|2\eta-1|\), the conditional class imbalance, not in the score \(u\). A quadratic calibration function does not mean the loss itself is quadratic in the score.
  • Reading the exponent in the wrong direction. If \(\delta(t)\) is proportional to \(t^2\), then surrogate excess controls regret through a square root. It does not imply that regret is proportional to the square of surrogate excess.
  • Treating endpoint infima as finite minimizers. For logistic and exponential losses at \(\eta=1\), the unrestricted infimum is approached as \(u\to+\infty\) and is not attained at a finite score. The calibration formulas remain valid because they use infima.
Key takeaway: Hinge calibration is exactly linear near zero, whereas logistic and exponential calibration are quadratic to leading order. Accordingly, surrogate excess transfers linearly to classification regret for hinge loss and through a square-root conversion for logistic and exponential loss.

Check Your Understanding

Use the definitions and expansions above to answer the following questions.

  1. For hinge loss, what are the constrained and unrestricted conditional risks when \(\theta=0.3\), and what is their difference?
  2. What is the leading-order logistic calibration value when \(t=0.05\)?
  3. Why is the exponential calibration function quadratic rather than linear near zero?
  4. If logistic surrogate excess risk is \(O(n^{-0.8})\), what classification-regret rate follows from the conversion proved here?
  5. At \(\eta=1\), why is it correct to use an infimum for logistic loss rather than claim a finite unrestricted minimizer?
Clinical Biostats