Tutorials › Statistical Learning (Graduate) › Pointwise Calibration and Surrogate Consistency

Surrogate Losses and Calibration · Tutorial 531 of 989

Pointwise Calibration and Surrogate Consistency

Learn why a positive, continuous calibration function turns small population surrogate excess risk into small classification regret.

Advanced 11 min read

What You'll Learn

  • Define conditional classification regret and the calibration function for a fixed score-to-label rule
  • Prove the pointwise-to-population regret bound
  • Show that vanishing surrogate excess implies vanishing classification regret
  • Derive the logistic calibration function for the standard sign rule
  • Use threshold bounds to quantify regret without assuming convexity of the calibration function
  • Distinguish a population implication from a guarantee about how a learning procedure performs

From Conditional Guarantees to Population Regret

A calibration result is first a statement about one feature value at a time: if a score makes the wrong classification, its conditional surrogate risk cannot be arbitrarily close to optimal when the conditional classification regret is substantial. The population question is whether this local fact still controls average classification performance when the score and the conditional distribution vary across feature values.

The answer is yes under a precise condition. If a calibration function is continuous and strictly positive at every positive regret level, then a sequence of predictors whose population surrogate excess risk tends to zero must also have classification regret tending to zero. The proof uses a threshold argument: substantial regret can occur only on a set whose probability is controlled by the surrogate excess.

Conditional and Population Regret

Consider binary labels \(Y\in\{-1,+1\}\), a feature vector \(X\), and a measurable real-valued score function \(g\). Write \(\eta(x)=P(Y=+1\mid X=x)\), using a version of the conditional probability. Fix the decision rule \(h(s)=+1\) for \(s\geq 0\) and \(h(s)=-1\) for \(s<0\). The Bayes decision is \(+1\) when \(\eta(x)\geq 1/2\), with either choice optimal at equality.

Definition: At a feature value with conditional probability \(\eta\), the conditional classification risk of a decision \(a\in\{-1,+1\}\) is \(C_0(\eta,a)=\eta\,\mathbf{1}\{a=-1\}+(1-\eta)\,\mathbf{1}\{a=+1\}\). Its conditional classification regret is \(r_\eta(s)=C_0(\eta,h(s))-\min(\eta,1-\eta)\). Thus \(r_\eta(s)=|2\eta-1|\) if \(h(s)\) is not Bayes-optimal, and \(r_\eta(s)=0\) otherwise.

In particular, \(0\leq r_\eta(s)\leq 1\). The population classification regret of \(g\) is \(R_0(h\circ g)-R_0^*=E[r_{\eta(X)}(g(X))]\), where \(R_0^*\) is the Bayes classification risk. This identity follows by conditioning the zero-one loss on \(X\) and subtracting the conditional Bayes risk.

For a margin loss \(\phi\), define the conditional surrogate risk and its infimum by \(C_\phi(\eta,s)=\eta\phi(s)+(1-\eta)\phi(-s)\) and \(C_\phi^*(\eta)=\inf_{u\in\mathbb R}C_\phi(\eta,u)\). The conditional surrogate excess at score \(s\) is \(e_\phi(\eta,s)=C_\phi(\eta,s)-C_\phi^*(\eta)\), which is nonnegative. Assume these quantities are measurable when evaluated at \(X\), and that the relevant expectations are finite.

Calibration Functions and the Pointwise Bound

A calibration function expresses how much conditional surrogate excess is unavoidable when the classification regret is at least a specified amount. For the fixed decision rule above, one standard definition is the lower envelope \(\psi(t)=\inf\{e_\phi(\eta,s):\eta\in[0,1],\,s\in\mathbb R,\,r_\eta(s)\geq t\}\) for \(0<t\leq1\), with \(\psi(0)=0\). An infimum over an empty set is \(+\infty\). Because the constraint sets shrink as \(t\) increases, \(\psi\) is nondecreasing.

Definition: The loss and decision rule are classification calibrated if \(\psi(t)>0\) for every \(t>0\). In the result below, we also assume \(\psi\) is continuous on \([0,1]\) and \(\psi(0)=0\). By the definition of the infimum, every \((\eta,s)\) satisfies \(e_\phi(\eta,s)\geq\psi(r_\eta(s))\).

The last inequality is the pointwise calibration bound. When the regret is positive, the pair \((\eta,s)\) belongs to the constraint set used to define \(\psi(r_\eta(s))\), so its excess cannot be smaller than that set’s infimum. When regret is zero, the inequality follows from nonnegative excess and \(\psi(0)=0\).

Worked Example: The Logistic Calibration Function

For the logistic margin loss \(\phi(s)=\log(1+e^{-s})\), the conditional risk is \(C_\phi(\eta,s)=\eta\log(1+e^{-s})+(1-\eta)\log(1+e^s)\). For \(0<\eta<1\), differentiating gives \(C_\phi'(\eta,s)=(e^s(1-\eta)-\eta)/(1+e^s)\). Its unique zero is \(s^*=\log(\eta/(1-\eta))\), and the derivative changes from negative to positive there. Substitution gives \(C_\phi^*(\eta)=H(\eta)=-\eta\log\eta-(1-\eta)\log(1-\eta)\). At \(\eta=0\) or \(1\), the infimum is \(0\), agreeing with the continuous extension of \(H\).

Suppose \(\eta>1/2\), so \(+1\) is Bayes-optimal. A score classified as \(-1\) must satisfy \(s<0\). The infimum of its conditional logistic risk is the boundary value \(C_\phi(\eta,0)=\log 2\): the risk decreases up to its unconstrained minimizer, which is positive, and therefore increases as \(s\) moves left from zero. Although zero is excluded by this tie convention for an erroneous negative decision, scores \(s\uparrow0\) approach the same infimum. The constrained excess is consequently \(\log2-H(\eta)\). By symmetry, the same expression holds for an erroneous positive decision when \(\eta<1/2\).

If the regret is \(t\), then \(|2\eta-1|=t\), so the smaller possible constrained excess at that exact regret is obtained at \(\eta=(1+t)/2\) or its reflection. The entropy decreases as \(|2\eta-1|\) increases: for \(0<t<1\), the derivative of \(\log2-H((1+t)/2)\) is \(\frac12\log((1+t)/(1-t))>0\). Taking the infimum over regrets at least \(t\) therefore gives

$$ \psi(t)=\log 2-H\left(\frac{1+t}{2}\right) =\frac{1+t}{2}\log(1+t)+\frac{1-t}{2}\log(1-t),\qquad 0\leq t\leq1, $$

where \(0\log0\) is interpreted as \(0\). This function is continuous on \([0,1]\), equals zero at zero, and is strictly positive for \(t>0\). This calculation uses the stated sign decision rule; a different score-to-label rule need not have this calibration function.

The Population Transfer Theorem

Let \(g_n\) be a sequence of measurable score functions. Assume the pointwise calibration bound holds almost surely for each \(g_n\), and assume the population surrogate excess is \(\delta_n=R_\phi(g_n)-R_\phi^*=E[e_\phi(\eta(X),g_n(X))]\). Here \(R_\phi(g)=E[\phi(Yg(X))]\), and the equality with the expected conditional excess is assumed to hold; it follows by conditioning on \(X\) when \(R_\phi^*=E[C_\phi^*(\eta(X))]\). This condition is met, for example, when the conditional infima can be approached by measurable score functions. The theorem concerns this population excess, not an empirical risk.

Theorem: Suppose \(\psi:[0,1]\to[0,\infty)\) is nondecreasing, continuous, satisfies \(\psi(0)=0\), and is positive for every \(t>0\). If \(\delta_n\to0\), then \(R_0(h\circ g_n)-R_0^*\to0\). In fact, for each \(a\in(0,1]\), \(P(r_{\eta(X)}(g_n(X))\geq a)\leq\delta_n/\psi(a)\).

Proof. Write \(r_n=r_{\eta(X)}(g_n(X))\). The pointwise calibration inequality and the conditional-excess identity give \(E[\psi(r_n)]\leq E[e_\phi(\eta(X),g_n(X))]=\delta_n\). On the event \(\{r_n\geq a\}\), monotonicity gives \(\psi(r_n)\geq\psi(a)>0\). Thus \(\psi(a)\mathbf{1}\{r_n\geq a\}\leq\psi(r_n)\) everywhere, and taking expectations yields \(\psi(a)P(r_n\geq a)\leq\delta_n\). This proves the probability bound.

Since \(0\leq r_n\leq1\), split its expectation according to whether it is below \(a\). On \(\{r_n<a\}\), it is at most \(a\); on the complement, it is at most \(1\). Therefore \(E[r_n]\leq a+P(r_n\geq a)\leq a+\delta_n/\psi(a)\). For fixed \(a>0\), positivity makes the denominator nonzero, so taking the limit superior in \(n\) gives \(\limsup_n E[r_n]\leq a\). This holds for every \(a\in(0,1]\); letting \(a\) decrease to zero gives \(E[r_n]\to0\). Since \(E[r_n]=R_0(h\circ g_n)-R_0^*\), the claimed conclusion follows. \(\square\)

Continuity is part of the usual regularity condition on a calibration function and ensures it has no jump at zero. The threshold proof itself uses positivity at each fixed positive threshold, along with monotonicity; it does not require differentiability or convexity. In particular, it avoids applying Jensen’s inequality to a function that may not be convex.

Worked Population Consequences

Worked Example: Vanishing Logistic Excess with Rare Errors

Let \(X\) be uniform on \([0,1]\), and let \(P(Y=+1\mid X=x)=0.8\) for every \(x\). The Bayes score is \(s^*=\log(0.8/0.2)=\log4>0\). For each positive integer \(n\), set \(g_n(x)=-1\) on \([0,1/n]\) and \(g_n(x)=\log4\) elsewhere. The classifier is wrong on exactly the first interval. Its conditional regret there is \(2(0.8)-1=0.6\), and elsewhere it is zero. Hence its population classification regret is exactly \(0.6/n\).

On the interval of errors, the conditional logistic risk at score \(-1\) is \(0.8\log(1+e)+0.2\log(1+e^{-1})\). Its conditional optimum is \(H(0.8)\). Define the exact excess \(d=0.8\log(1+e)+0.2\log(1+e^{-1})-H(0.8)\), which is positive because \(-1\ne\log4\) and the conditional risk has a unique minimizer. Outside that interval the score is optimal. Therefore \(R_\phi(g_n)-R_\phi^*=d/n\to0\), while the classification regret is exactly \(0.6/n\to0\). Numerically, \(d\approx0.612859264\); the exact finite-\(n\) equality uses \(d\), not its rounded approximation.

Worked Example: A Numerical Threshold Guarantee

For logistic loss, suppose a predictor has population surrogate excess at most \(0.001\). Consider the event that its conditional classification regret is at least \(0.2\). The logistic calibration function gives \(\psi(0.2)=\log2-H(0.6)\). Using \(H(0.6)=-0.6\log(0.6)-0.4\log(0.4)\), we obtain \(\psi(0.2)\approx0.0201355\). The theorem’s probability bound is therefore \(P(r\geq0.2)\leq0.001/0.0201355\approx0.0497\).

To bound mean regret, split at \(0.2\). Regret is at most \(0.2\) below the threshold and at most \(1\) above it, so \(E[r]\leq0.2+0.8P(r\geq0.2)\leq0.2+0.8(0.0497)\approx0.2398\). This bound is conservative, but it follows directly from calibration and the excess-risk premise. It does not assume that \(\psi\) is convex or that \(E[\psi(r)]\) equals \(\psi(E[r])\).

What the Implication Does—and Does Not—Say

The theorem separates two claims. Calibration supplies a pointwise link between conditional surrogate excess and conditional classification regret. Averaging that link, then using positivity away from zero, transfers a vanishing population surrogate excess into vanishing population classification regret. Continuity and positivity are properties of the calibration function, not assumptions that the feature distribution has a density or that the conditional probability stays away from \(1/2\).

The premise is important: the theorem starts with a sequence whose population surrogate excess tends to zero. It does not by itself establish that a particular fitting procedure produces such a sequence. Nor does it say that a small finite-sample empirical surrogate risk is automatically a small population excess. Those are separate questions from the population transfer proved here.

  • Pitfall: applying Jensen’s inequality without checking curvature. From \(E[\psi(r)]\leq\delta\), it is not generally valid to conclude \(\psi(E[r])\leq\delta\); that direction would require suitable convexity. Use the threshold event and the bound \(P(r\geq a)\leq\delta/\psi(a)\) instead.
  • Pitfall: changing the decision rule while keeping the same calibration function. The logistic formula above was derived for the specified sign rule. A different map from scores to labels can alter which scores count as errors and therefore alter the constrained infimum.
  • Pitfall: treating a rounded number as an exact risk. Keep the exact conditional excess in finite-sample or finite-\(n\) equalities, and mark decimal evaluations as approximations.
Key takeaway: If pointwise calibration gives a nondecreasing function \(\psi\) that is positive at every positive regret level, then vanishing population surrogate excess forces the probability of any fixed-size classification error to vanish. Since regret is bounded by one, this also forces its population mean to vanish.

Check Your Understanding

Use the definitions and threshold argument above to answer the following questions.

  1. Why is the conditional classification regret bounded above by one, and where is that bound used in the population proof?
  2. Explain why the pointwise calibration inequality holds when conditional classification regret is zero.
  3. For a fixed \(a>0\), derive the probability bound from \(E[\psi(r_n)]\leq\delta_n\).
  4. Why does the proof not require \(\psi\) to be convex?
  5. What role does fixing the score-to-label rule play in deriving the logistic calibration function?
  6. Does the theorem establish that a learning algorithm has vanishing population surrogate excess? Explain the distinction.
Clinical Biostats