Why Boundary Conventions Matter
A real-valued classification score determines a label by its sign, but the score \(0\) has no positive or negative sign. A prediction rule must therefore specify what happens at zero. This convention matters for the classification error of a particular score. Calibration, however, is usually defined with an infimum over a constrained set of scores that includes the boundary. The distinction lets the calibration gap describe the cost of approaching a wrong-sign decision without making its value depend on how a tie is broken.
Write \(\eta=P(Y=+1\mid X=x)\) for the conditional probability of the positive label at a fixed \(x\), and let \(a\in\mathbb{R}\) be the score. For a margin loss \(\phi\), the conditional surrogate risk is
The first term is the loss when \(Y=+1\), and the second is the loss when \(Y=-1\). In this tutorial, assume \(\phi:\mathbb{R}\to[0,\infty)\) is finite-valued and convex. In particular, \(C_\eta(a)\) is finite and continuous in \(a\). Nonnegativity will also ensure that the infima used below are finite.
When \(\eta>1/2\), \(+1\) is the unique Bayes label; when \(\eta<1/2\), \(-1\) is the unique Bayes label. When \(\eta=1/2\), both labels minimize the conditional risk. Thus a tie rule affects the predicted label at \(a=0\), but cannot create classification regret at \(\eta=1/2\).
The constraint includes scores on the boundary \(a=0\). If \(\eta>1/2\), it selects \(a\leq0\), the nonpositive side of the score axis; if \(\eta<1/2\), it selects \(a\geq0\). At \(\eta=1/2\), every real score satisfies the constraint. These are closed sets, so the definition does not depend on whether a particular prediction rule assigns zero to the positive or negative class.
Boundary Scores and Classification Regret
Under the positive-at-zero convention, a score is classified incorrectly when \(\eta>1/2\) and \(a<0\), or when \(\eta<1/2\) and \(a\geq0\). The first set is open at zero, whereas the constrained sets in \(H^-\) are closed. Since \(C_\eta\) is continuous, adding the boundary point to an open half-line does not change its infimum: values at zero are limits of values from that half-line. Thus \(H^-\) captures the infimum of the surrogate risk over wrong predictions, including the limiting boundary score. The other side already includes zero under this tie convention.
The conditional zero-one regret has a particularly direct form. If \(\eta\ne1/2\), a prediction incurs regret only when it differs from the unique Bayes label, and the regret in that case is \(|2\eta-1|\). At the tie \(\eta=1/2\), either prediction is Bayes, so the regret is zero for every score.
To verify the formula, the risk of predicting \(+1\) is \(1-\eta\), and the risk of predicting \(-1\) is \(\eta\). The smaller risk is \(\min(\eta,1-\eta)\). If \(\eta>1/2\), predicting \(-1\) has excess risk \(\eta-(1-\eta)=2\eta-1\), while predicting \(+1\) has zero excess. If \(\eta<1/2\), predicting \(+1\) has excess risk \((1-\eta)-\eta=1-2\eta\), while predicting \(-1\) has zero excess. At equality the two risks are equal. This proves the result.
Worked Example: A Zero Score Under Two Tie Rules
Let \(\eta=0.8\) and \(a=0\). Under the positive-at-zero rule, the prediction is \(+1\). Its conditional risk is \(1-\eta=0.2\), which is the Bayes risk, so its regret is \(0\). Under the alternative rule \(g_-(a)=+1\) for \(a>0\) and \(g_-(a)=-1\) for \(a\leq0\), the prediction is \(-1\). Its risk is \(\eta=0.8\), and its regret is \(0.8-0.2=0.6=|2\eta-1|\).
The two predictions differ only because the tie convention differs. The constrained set for the surrogate infimum is \(a\leq0\) in either case, and contains the boundary score \(a=0\). The classification regret of that particular score is therefore convention-dependent, while the constrained calibration gap is defined independently of the tie rule.
Why the Gap Is Well-Defined at the Probability Tie
At \(\eta=1/2\), the constraint in \(H^-\) becomes \(a\cdot0\leq0\), which holds for every real \(a\). Thus \(H^-(1/2)\) and \(H(1/2)\) are infima over the same set. To conclude that their difference is zero, the infima must be finite. Under the stated assumption that \(\phi\) is finite-valued and nonnegative, \(C_\eta(a)\geq0\), while \(C_\eta(0)=\phi(0)<\infty\). The unrestricted infimum is therefore finite. The constrained set always contains zero, so its infimum is finite as well.
Proof. Since \(C_\eta(a)\geq0\) and \(C_\eta(0)=\phi(0)<\infty\), the infimum over all scores satisfies \(0\leq H(\eta)\leq\phi(0)\). The constrained set contains \(a=0\), so \(0\leq H^-(\eta)\leq\phi(0)\) too. Because the constrained set is a subset of \(\mathbb{R}\), its infimum cannot be smaller than the infimum over all scores: \(H^-(\eta)\geq H(\eta)\). At \(\eta=1/2\), the constraint holds for every \(a\), so the two infima are equal and their finite difference is zero. \(\square\)
The finiteness condition is substantive. If one allowed, for example, \(\phi(t)=-t^2\), then \(C_{1/2}(a)=-a^2\), and both infima would be \(-\infty\). Equality of those extended-real infima would not define a difference \(\Delta_\phi(1/2)\). Nonnegative losses rule out this problem.
Worked Example: The Hinge Loss at a Non-Tie Boundary
Take \(\phi(t)=\max(1-t,0)\) and \(\eta=0.7\). Then \(C_{0.7}(a)=0.7\max(1-a,0)+0.3\max(1+a,0)\). For \(-1\leq a\leq1\), this is \(0.7(1-a)+0.3(1+a)=1-0.4a\). For \(a\geq1\), it is \(0.3(1+a)\); for \(a\leq-1\), it is \(0.7(1-a)\).
On \([-1,1]\), \(1-0.4a\) decreases as \(a\) increases, so its minimum there is \(0.6\) at \(a=1\). On \([1,\infty)\), \(0.3(1+a)\) increases, so its minimum is also \(0.6\) at \(a=1\). On \((-\infty,-1]\), \(0.7(1-a)\) decreases as \(a\) increases, so its minimum there is \(1.4\) at \(a=-1\). Hence \(H(0.7)=0.6\).
Here \(a(\eta-\tfrac12)\leq0\) means \(a\leq0\). On \([-1,0]\), \(1-0.4a\) is minimized at \(a=0\), with value \(1\); on \((-\infty,-1]\), the minimum is \(1.4\). Therefore \(H^-(0.7)=1\) and \(\Delta_\phi(0.7)=1-0.6=0.4\). The boundary score \(a=0\) is included in the constrained set. Under the positive-at-zero rule it predicts \(+1\), so it is not a wrong classification at this \(\eta\); nevertheless, wrong scores \(a<0\) approach zero, and their surrogate-risk infimum is \(1\).
Worked Example: Logistic Loss at the Probability Tie
Take \(\phi(t)=\log(1+e^{-t})\) and \(\eta=1/2\). The conditional risk is $$ C_{1/2}(a)=\tfrac12\log(1+e^{-a})+\tfrac12\log(1+e^a). $$
Using \((1+e^{-a})(1+e^a)=2+e^a+e^{-a}\geq4\), we obtain \(C_{1/2}(a)=\tfrac12\log\{(1+e^{-a})(1+e^a)\}\geq\log 2\). Equality holds at \(a=0\), since the product there is \(4\). Thus \(H(1/2)=\log2\). Every score satisfies the constrained condition at \(\eta=1/2\), so \(H^-(1/2)=\log2\) and \(\Delta_\phi(1/2)=0\). Regardless of the zero-score tie rule, the classification regret at this probability tie is also zero.
Worked Example: Logistic Loss Just Below the Tie
Let \(\eta=0.3\), again with \(\phi(t)=\log(1+e^{-t})\). Differentiating the conditional risk gives $$ C'_{0.3}(a)=\frac{0.7e^a-0.3}{1+e^a}. $$
The derivative is zero exactly when \(e^a=3/7\), so the unrestricted minimizer is \(a_*=\log(3/7)<0\). At this minimizer, direct substitution gives \(C_{0.3}(a_*)=-0.3\log(0.3)-0.7\log(0.7)\), and hence this is \(H(0.3)\). The constrained set is \(a\geq0\). The derivative is positive for \(a\geq0\), because \(0.7e^a-0.3\geq0.4>0\), so the constrained minimum occurs at \(a=0\) and equals \(\log2\). Therefore $$ \Delta_\phi(0.3)=\log2+0.3\log(0.3)+0.7\log(0.7)\approx0.0823. $$
At \(a=0\), the positive-at-zero rule predicts \(+1\), although the Bayes label is \(-1\). Its classification regret is \(1-2(0.3)=0.4\). The calibration gap is not this classification regret: it is the difference between two surrogate-risk infima.
Common Pitfalls and Practical Interpretation
- Treating zero as if it had an automatic sign. A classifier must state its tie rule. At \(\eta\ne1/2\), the rule can change the regret of a zero score; at \(\eta=1/2\), neither label has regret.
- Using a strict wrong-sign constraint without checking the boundary. The constrained-infimum definition uses a closed set. For continuous conditional risk, its infimum agrees with the infimum over the corresponding open wrong-sign side when zero is only a limiting point. This makes the boundary explicit.
- Subtracting infinite infima. Equality of two infima is not enough to define their difference if both are infinite. The finite, nonnegative loss assumption guarantees finite conditional infima here.
- Interpreting a zero calibration gap at \(\eta=1/2\) as a defect. At that probability, every label is Bayes-optimal, so there is no classification regret to penalize. The zero gap expresses that fact; it does not assert that all scores minimize the surrogate risk.
- Confusing calibration gap with the regret of one score. A regret is evaluated at a chosen prediction; \(\Delta_\phi(\eta)\) compares a constrained surrogate infimum with the unrestricted one.
The boundary convention matters most when interpreting individual predictions and when translating between strict mistakes and constrained optimization. The closed constraint gives a stable, tie-rule-independent definition: it includes zero, remains meaningful at \(\eta=1/2\) under finite nonnegative losses, and records the least surrogate risk attainable on the non-Bayes side or its boundary.
Check Your Understanding
Work through these questions using the positive-at-zero convention unless a question specifies otherwise.
- For \(\eta=0.65\) and \(a=0\), what label is predicted, and what is the conditional classification regret?
- Why does the constraint \(a(\eta-\tfrac12)\leq0\) include every score when \(\eta=1/2\)?
- What assumption in this tutorial ensures that \(H(\eta)\) and \(H^-(\eta)\) are finite?
- For \(\eta<1/2\), which scores belong to the constrained set, and which scores are classification errors under the positive-at-zero rule?
- Why is the logistic calibration gap at \(\eta=0.3\) not the same quantity as the regret of the zero score?