Tutorials › Statistical Learning (Graduate) › Calibration Bounds for Kernel Classification Scores

Kernel Classification Guarantees · Tutorial 767 of 989

Calibration Bounds for Kernel Classification Scores

Learn when hinge and logistic surrogate regret control classification regret, and how to convert a kernel score’s excess surrogate risk into a bound on its excess zero-one risk.

Advanced 13 min read

What You'll Learn

  • Define zero-one and surrogate risks for a measurable score and binary response
  • Identify the conditional class regret associated with a score’s classification error
  • Derive the hinge-loss calibration bound and its conditions
  • Derive the logistic-loss calibration function from Bernoulli Kullback–Leibler divergence
  • Use convexity to turn conditional bounds into population risk bounds
  • Apply the bounds to kernel scores without requiring additional kernel assumptions

Why Calibration Bounds Matter

A kernel score \(f\) is often fitted by minimizing a surrogate loss rather than the discontinuous zero-one loss. To use that fitting objective as a guarantee about classification, one needs a link between the two kinds of risk: if the score has small excess surrogate risk, how large can its excess classification risk still be? A calibration bound answers this by bounding the latter in terms of the former.

The bound is a population statement. It applies to any measurable real-valued score, so it applies in particular to a measurable score in a reproducing kernel Hilbert space (RKHS). The RKHS structure determines which scores an estimation procedure can produce; it is not, by itself, needed for the calibration argument.

Risks and Conditional Regret

Let \(X\) take values in a standard Borel feature space and let \(Y\in\{-1,+1\}\). Write \(\eta(x)=P(Y=+1\mid X=x)\) for a measurable version of the conditional class probability. For a measurable score \(f\), use the classifier \(g_f(x)=+1\) when \(f(x)\geq 0\) and \(g_f(x)=-1\) otherwise. This convention fixes how ties at zero are classified.

Definition: The zero-one risk is \(R_{01}(f)=P(g_f(X)\ne Y)\). Its Bayes risk is \(R_{01}^*=\inf_g P(g(X)\ne Y)=E[\min\{\eta(X),1-\eta(X)\}]\), where the infimum is over measurable classifiers. For a loss \(\phi:\mathbb{R}\to[0,\infty)\), the surrogate risk is \(R_\phi(f)=E[\phi(Yf(X))]\), and its Bayes surrogate risk is \(R_\phi^*=\inf_h R_\phi(h)\), with the infimum over measurable real-valued scores. The excess risks are \(R_{01}(f)-R_{01}^*\) and \(R_\phi(f)-R_\phi^*\).

Conditionally on \(X=x\), the classification regret of \(f\) is zero if its predicted class is a Bayes class, and is \(|2\eta(x)-1|\) if it predicts the other class. When \(\eta(x)=1/2\), both classes are Bayes classes and the regret is zero. Thus, writing \(d_f(x)\) for this conditional regret,

$$ R_{01}(f)-R_{01}^*=E[d_f(X)],\qquad 0\leq d_f(X)\leq 1. $$

This conditional quantity is the bridge to surrogate risk. For each loss, we first show how much conditional surrogate regret is forced when the score predicts the wrong class.

Worked Example: Conditional Hinge Regret

Suppose \(\eta(x)=0.8\) and the score is \(t=f(x)=-0.4\). The classifier predicts \(-1\), although \(+1\) is the more probable class. The conditional classification regret is \(0.8-0.2=0.6\).

For the hinge loss \(\phi(t)=(1-t)_+\), the conditional surrogate risk is \(0.8(1-(-0.4))_+ + 0.2(1+(-0.4))_+=0.8(1.4)+0.2(0.6)=1.24\). The minimum conditional hinge risk is \(2\min(0.8,0.2)=0.4\), so the conditional surrogate regret is \(1.24-0.4=0.84\). It is at least the classification regret \(0.6\), as the hinge calibration bound requires.

Hinge-Loss Calibration

The hinge loss is \(\phi_{\mathrm{hinge}}(u)=(1-u)_+\), where \(a_+=\max(a,0)\). Its conditional risk at class probability \(\eta\) and score \(t\) is \(A_\eta(t)=\eta(1-t)_+ +(1-\eta)(1+t)_+\). The minimum over real \(t\) is \(2\min(\eta,1-\eta)\): for \(\eta>1/2\), it is attained by any \(t\geq1\); for \(\eta<1/2\), by any \(t\leq-1\); and for \(\eta=1/2\), by any \(t\in[-1,1]\).

Theorem: Suppose \(f\) is measurable and \(R_{\mathrm{hinge}}(f)<\infty\). Then \(R_{01}(f)-R_{01}^*\leq R_{\mathrm{hinge}}(f)-R_{\mathrm{hinge}}^*\). Consequently, the excess zero-one risk is at most \(\min\{1,\ R_{\mathrm{hinge}}(f)-R_{\mathrm{hinge}}^*\}\).

Proof. Fix \(x\), set \(\eta=\eta(x)\), and write \(t=f(x)\). If \(\eta>1/2\) but \(t<0\), the classifier is wrong. When \(-1\leq t<0\), \(A_\eta(t)=1-(2\eta-1)t\geq1\). When \(t<-1\), \(A_\eta(t)=\eta(1-t)\geq2\eta\geq1\). Since the conditional minimum is \(2(1-\eta)=1-(2\eta-1)\), the conditional surrogate regret is at least \(2\eta-1\), exactly the conditional classification regret. If \(\eta<1/2\) and \(t\geq0\), symmetry gives conditional surrogate regret at least \(1-2\eta\), again the classification regret. In every other case, the classifier has zero conditional classification regret, while conditional surrogate regret is nonnegative. Therefore the conditional surrogate regret is at least \(d_f(x)\) for every \(x\).

The conditional minima above integrate to \(R_{\mathrm{hinge}}^*\). Indeed, their minimizing scores can be selected measurably from \(\eta(x)\) (choose \(1\) when \(\eta>1/2\), \(-1\) when \(\eta<1/2\), and \(0\) at equality). Integrating the pointwise inequality therefore gives \(R_{\mathrm{hinge}}(f)-R_{\mathrm{hinge}}^*\geq E[d_f(X)]=R_{01}(f)-R_{01}^*\). The last bound follows because an excess zero-one risk cannot exceed \(1\). \(\square\)

Worked Example: A Population Hinge Guarantee

Suppose a measurable kernel score has excess hinge risk \(0.12\). The theorem gives \(R_{01}(f)-R_{01}^*\leq0.12\). This does not say that the classifier’s total error is at most \(0.12\): if the Bayes risk is \(0.08\), the resulting total-risk bound is \(R_{01}(f)\leq0.08+0.12=0.20\). The guarantee concerns error above the best possible classification risk under the data distribution.

Logistic-Loss Calibration

Use the logistic loss \(\phi_{\mathrm{log}}(u)=\log(1+e^{-u})\), with natural logarithms. At conditional probability \(\eta\), its conditional risk is \(A_\eta(t)=\eta\log(1+e^{-t})+(1-\eta)\log(1+e^t)\). If \(q=(1+e^{-t})^{-1}\), this is the Bernoulli cross-entropy \(-\eta\log q-(1-\eta)\log(1-q)\). Its infimum is the binary entropy \(H(\eta)=-\eta\log\eta-(1-\eta)\log(1-\eta)\), with \(0\log0=0\). For \(0<\eta<1\), the infimum is attained at \(q=\eta\), equivalently \(t=\log(\eta/(1-\eta))\); at \(\eta=0\) or \(1\), it is an infimum approached as \(t\) tends to the corresponding infinity.

Definition: For \(0\leq u\leq1\), define the logistic calibration function \(\psi_{\mathrm{log}}(u)=\frac{1+u}{2}\log(1+u)+\frac{1-u}{2}\log(1-u)\), interpreting the endpoint terms by continuity. It is increasing and convex, with \(\psi_{\mathrm{log}}(0)=0\) and \(\psi_{\mathrm{log}}(1)=\log2\). Define its capped inverse by \(\psi_{\mathrm{log}}^{-1}(s)=\sup\{u\in[0,1]:\psi_{\mathrm{log}}(u)\leq s\}\); in particular, it equals \(1\) for \(s\geq\log2\).
Theorem: If \(f\) is measurable and \(R_{\mathrm{log}}(f)<\infty\), then \(\psi_{\mathrm{log}}\big(R_{01}(f)-R_{01}^*\big)\leq R_{\mathrm{log}}(f)-R_{\mathrm{log}}^*\). Equivalently, \(R_{01}(f)-R_{01}^*\leq\psi_{\mathrm{log}}^{-1}\big(R_{\mathrm{log}}(f)-R_{\mathrm{log}}^*\big)\).

Proof. At a fixed \(x\), with conditional probability \(\eta\), the conditional logistic excess is \(A_\eta(t)-H(\eta)=\eta\log(\eta/q)+(1-\eta)\log((1-\eta)/(1-q))\), the Kullback–Leibler divergence between Bernoulli probabilities \(\eta\) and \(q\). Suppose first that \(\eta>1/2\) and the classifier is wrong. Then \(t<0\), so \(q<1/2\). As a function of \(q\), the divergence has derivative \((q-\eta)/(q(1-q))<0\) on \(0<q\leq1/2\); hence its infimum over that range is at \(q=1/2\). For \(\eta<1/2\) and a wrong prediction, the tie convention allows \(t=0\), and wrong predictions have \(q\geq1/2\). The derivative is positive there, so again the minimum is at \(q=1/2\). Thus whenever the conditional classification regret is \(u=|2\eta-1|\), a wrong prediction forces logistic excess at least \(\log2-H(\eta)=\psi_{\mathrm{log}}(u)\). If the prediction is Bayes, \(u=0\) and the same lower bound is zero.

The pointwise conditional infimum integrates to \(R_{\mathrm{log}}^*\). To see this without assuming a finite optimal score, restrict scores temporarily to \([-M,M]\). The conditional minimizing score is the log odds clipped to that interval, with endpoint values chosen at \(\eta=0,1\); it is measurable. The resulting conditional minimum decreases to \(H(\eta)\) as \(M\) increases. It lies between \(0\) and \(\log2\), since score \(0\) is available, so dominated convergence shows that the infimum population risk is \(E[H(\eta(X))]\). It follows that the conditional inequality just proved integrates to \(R_{\mathrm{log}}(f)-R_{\mathrm{log}}^*\geq E[\psi_{\mathrm{log}}(d_f(X))]\). Finally, \(\psi_{\mathrm{log}}\) is convex: on \(0<u<1\), its second derivative is \(1/(1-u^2)>0\), and it extends continuously to the endpoints. Jensen’s inequality gives \(E[\psi_{\mathrm{log}}(d_f(X))]\geq\psi_{\mathrm{log}}(E[d_f(X)])\). Using \(E[d_f(X)]=R_{01}(f)-R_{01}^*\) proves the result. Monotonicity and the definition of the capped inverse give the equivalent bound. \(\square\)

Worked Example: Logistic Regret at a Decision Boundary

Let \(\eta=0.75\) and \(t=0\). The score predicts \(+1\), so it is correct here; to examine the boundary penalty for a wrong prediction, approach \(t=0\) from below. At the boundary, \(q=1/2\), and the conditional logistic excess is \(\log2-H(0.75)=0.75\log(1.5)+0.25\log(0.5)\). Numerically this is \(0.75(0.405465)+0.25(-0.693147)=0.130812\). The conditional classification regret for a wrong prediction is \(2(0.75)-1=0.5\). The calibration function gives the same quantity: \(\psi_{\mathrm{log}}(0.5)=0.75\log(1.5)+0.25\log(0.5)=0.130812\). For \(\eta>1/2\), a strictly negative score is required to predict incorrectly, so this value is the limiting minimum as \(t\) approaches zero from below.

Using and Interpreting the Bounds

The two losses give different conversions. Hinge excess risk controls classification excess risk linearly. Logistic excess risk is converted through \(\psi_{\mathrm{log}}^{-1}\), which is nonlinear and capped at one. A useful simpler logistic consequence follows from \(\psi_{\mathrm{log}}''(u)\geq1\), together with \(\psi_{\mathrm{log}}(0)=\psi_{\mathrm{log}}'(0)=0\): integrating twice gives \(\psi_{\mathrm{log}}(u)\geq u^2/2\). Therefore \(R_{01}(f)-R_{01}^*\leq\min\{1,\sqrt{2(R_{\mathrm{log}}(f)-R_{\mathrm{log}}^*)}\}\).

Worked Example: A Simple Logistic Risk Conversion

Suppose the excess logistic risk of a kernel score is \(0.02\). The quadratic consequence gives \(R_{01}(f)-R_{01}^*\leq\sqrt{2(0.02)}=\sqrt{0.04}=0.2\). The sharper calibration-function bound is \(\psi_{\mathrm{log}}^{-1}(0.02)\); it can be found by solving \(\psi_{\mathrm{log}}(u)=0.02\) on \([0,1]\). The quadratic bound avoids numerical inversion and is valid, though it need not be the tightest available conversion.

Neither theorem requires a special kernel, a bounded RKHS norm, or a particular way of choosing the score. Those conditions may matter when proving that a fitted score has small excess surrogate risk, but that is a separate step. Calibration begins once such an excess-risk bound is available, and turns it into a guarantee relative to the Bayes classification risk.

Common Pitfall

A common mistake is to treat the logistic conversion as linear, for example claiming that excess zero-one risk is at most excess logistic risk. The conditional calculation shows why this reasoning fails: at class probability \(\eta=0.75\), a wrong score can have classification regret \(0.5\), while its smallest logistic regret is only about \(0.131\). The correction is to use \(\psi_{\mathrm{log}}^{-1}\), or a valid looser consequence such as the square-root bound. The hinge loss has a linear bound, but that fact does not transfer to every surrogate loss.

Key takeaway: For measurable binary-classification scores with finite surrogate risk, hinge excess risk bounds excess zero-one risk directly, while logistic excess risk controls it through a convex calibration function. The RKHS setting does not change these population inequalities; it enters when establishing how small the surrogate excess risk of the fitted score is.

Check Your Understanding

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

  1. Why does the hinge bound compare excess risks rather than total risks?
  2. Under the stated tie convention, when is a score of zero classified as \(+1\), and how does this affect the logistic boundary argument?
  3. For \(\eta=0.7\), calculate the conditional classification regret if the score predicts \(-1\).
  4. What property of the logistic calibration function permits the passage from a conditional inequality to a population inequality?
  5. Which additional question must be answered before a calibration bound can be applied to a score produced by a particular kernel-learning procedure?
Clinical Biostats