Tutorials › Statistical Learning (Graduate) › Bernstein Risk Bounds for Fixed Predictors

Concentration for Learning · Tutorial 107 of 989

Bernstein Risk Bounds for Fixed Predictors

Use Bernstein’s inequality to turn bounded-loss variance into confidence bounds for the true risk of a fixed predictor.

Beginner 12 min read

What You'll Learn

  • Define the risk, empirical risk, and loss variance for a fixed predictor.
  • State the bounded-variable Bernstein inequality used for risk deviations.
  • Derive an upper confidence bound with the correct tail direction.
  • Construct a two-sided confidence bound by controlling both tails.
  • Calculate Bernstein radii for explicit bounded-loss distributions.
  • Distinguish a population-variance guarantee from a data-dependent variance estimate.

Why Variance Matters for Risk Bounds

A fixed predictor is evaluated on a sample, so its empirical risk fluctuates around its true risk. A range-only bound treats every possible loss value as equally influential. Bernstein’s inequality also uses the loss variance: when most losses are concentrated near their mean, the resulting confidence radius can be smaller.

The word fixed is important. The predictor must be chosen independently of the observations used to evaluate it. A bound for one fixed predictor does not automatically hold for a predictor selected after examining the same sample.

Risk, Empirical Risk, and Loss Variance

Let \(Z_1,\ldots,Z_n\) be independent and identically distributed observations with distribution \(P\). Fix a predictor \(h\), and let \(\ell_h(Z)\) be its loss on an observation \(Z\). Suppose the loss is measurable and satisfies \(0\leq \ell_h(Z)\leq B\) almost surely for a finite constant \(B>0\).

Definition: The true risk of the fixed predictor is \(R(h)=E[\ell_h(Z)]\). Its empirical risk on the sample is \(\widehat R_n(h)=n^{-1}\sum_{i=1}^n\ell_h(Z_i)\). The loss variance is \(\sigma_h^2=\operatorname{Var}(\ell_h(Z))\).

The observations are identically distributed, so each loss has mean \(R(h)\) and variance \(\sigma_h^2\). The empirical risk is an average of independent losses. In particular, this setup gives \(E[\widehat R_n(h)]=R(h)\) and \(\operatorname{Var}(\widehat R_n(h))=\sigma_h^2/n\). The variance appearing in the bound below is the variance under the data distribution, not a variance computed from the observed sample.

The Bernstein Inequality Used Here

For clarity, write the bounded-variable inequality in the form needed for this application. If \(X_1,\ldots,X_n\) are independent, mean-zero random variables with \(|X_i|\leq b\) almost surely and \(\sum_{i=1}^n\operatorname{Var}(X_i)\leq v\), then for every \(t>0\),

$$ P\left(\sum_{i=1}^n X_i\geq \sqrt{2vt}+\frac{2bt}{3}\right)\leq e^{-t}. $$

This is a standard Bernstein tail bound, stated with a convenient explicit threshold. Here \(b\) controls the absolute size of each centered summand, while \(v\) controls their total variance. The linear term in \(t\) remains important for very small confidence levels; the square-root term is where a small variance improves the radius.

One-Sided Bernstein Risk Bounds

Theorem: Under the bounded-loss and independent, identically distributed sampling assumptions above, for every \(0<\delta<1\),
$$ P\left( R(h)-\widehat R_n(h) \leq \sqrt{\frac{2\sigma_h^2\log(1/\delta)}{n}} +\frac{2B\log(1/\delta)}{3n} \right)\geq 1-\delta. $$

Equivalently, with probability at least \(1-\delta\), the true risk is no more than the empirical risk plus the displayed radius. To prove the direction shown, center each loss and apply Bernstein to the negative centered losses.

1
Center the losses.
Set \(X_i=\ell_h(Z_i)-R(h)\). Then \(E[X_i]=0\), \(\operatorname{Var}(X_i)=\sigma_h^2\), and \(|X_i|\leq B\), since both \(\ell_h(Z_i)\) and its mean lie in \([0,B]\).
2
Choose the tail direction.
The desired deviation is \(R(h)-\widehat R_n(h)\), which equals the average of \(-X_i\). Apply the upper-tail inequality to \(-X_i\), not to \(X_i\).
3
Substitute the variance and threshold.
The variables \(-X_i\) have mean zero, variance \(\sigma_h^2\), and absolute value at most \(B\). Thus their total variance is \(n\sigma_h^2\), and Bernstein applies with \(v=n\sigma_h^2\), \(b=B\), and \(t=\log(1/\delta)\).

In detail, \(\sum_{i=1}^n(-X_i)=n(R(h)-\widehat R_n(h))\). Bernstein therefore gives

$$ P\left( n(R(h)-\widehat R_n(h)) \geq \sqrt{2n\sigma_h^2t}+\frac{2Bt}{3} \right)\leq e^{-t}. $$

Take \(t=\log(1/\delta)\), so \(e^{-t}=\delta\), and divide the threshold by \(n\). The probability that \(R(h)-\widehat R_n(h)\) exceeds the resulting radius is at most \(\delta\), proving the theorem. \(\square\)

The same reasoning applied to \(X_i\), rather than \(-X_i\), bounds the opposite deviation \(\widehat R_n(h)-R(h)\). Applying each one-sided result with failure probability \(\delta/2\) and using the union bound gives a two-sided statement.

Corollary: Under the same assumptions, for every \(0<\delta<1\),
$$ P\left( \left|\widehat R_n(h)-R(h)\right| \leq \sqrt{\frac{2\sigma_h^2\log(2/\delta)}{n}} +\frac{2B\log(2/\delta)}{3n} \right)\geq 1-\delta. $$

Indeed, each tail has probability at most \(\delta/2\) when \(t=\log(2/\delta)\). The event that either tail exceeds the common radius has probability at most \(\delta/2+\delta/2=\delta\). This proves the corollary. \(\square\)

Worked Examples

Worked Example: Rare Binary Losses

Suppose a fixed predictor has loss \(1\) with probability \(0.02\) and loss \(0\) otherwise. For \(n=1000\) observations, calculate the one-sided Bernstein radius at confidence level \(95\%\), meaning \(\delta=0.05\).

The risk and variance are \(R(h)=0.02\) and \(\sigma_h^2=0.02(1-0.02)=0.0196\). The loss is in \([0,1]\), so \(B=1\). Also, \(t=\log(1/0.05)=\log(20)\approx 2.9957\).

The square-root contribution is \[ \sqrt{\frac{2(0.0196)(2.9957)}{1000}} =\sqrt{0.00011743} \approx 0.01084. \] The linear contribution is \[ \frac{2(1)(2.9957)}{3(1000)} \approx 0.00200. \] Thus the radius is approximately \(0.01084+0.00200=0.01284\). The guarantee is \(P(R(h)\leq \widehat R_n(h)+0.01284)\geq 0.95\). For comparison, the one-sided Hoeffding radius for the same \(n\), \(B\), and \(\delta\) is \(\sqrt{\log(20)/(2(1000))}\approx 0.03870\). The smaller Bernstein radius reflects the low variance of this loss distribution.

Worked Example: Losses on a Wider Range

Let the loss equal \(2\) with probability \(0.1\) and \(0\) with probability \(0.9\). Take \(n=100\) and \(\delta=0.1\). Find the one-sided radius and the risk upper bound if the sample contains seven losses equal to \(2\).

Here \(B=2\), and \(R(h)=2(0.1)+0(0.9)=0.2\). The variance is \[ \sigma_h^2=E[\ell_h(Z)^2]-R(h)^2 =4(0.1)-0.2^2=0.4-0.04=0.36. \] With \(t=\log(10)\approx 2.3026\), the square-root contribution is \[ \sqrt{\frac{2(0.36)(2.3026)}{100}} =\sqrt{0.0165787} \approx 0.12876. \] The linear contribution is \[ \frac{2(2)(2.3026)}{3(100)} \approx 0.03070. \] The total radius is approximately \(0.15946\). Seven losses of \(2\) and 93 losses of \(0\) give \(\widehat R_n(h)=14/100=0.14\). On the event covered by the one-sided guarantee, \(R(h)\leq 0.14+0.15946=0.29946\); that event has probability at least \(0.9\) over repeated samples. This is a probability statement about the sampling procedure, not a statement that conditions on the observed count and assigns a new probability to the fixed risk.

Worked Example: Binary Classification Error

For a fixed classifier, suppose the error indicator is \(1\) with probability \(0.25\) and \(0\) otherwise. A sample of \(n=40\) cases contains 6 errors. Calculate a one-sided \(95\%\) Bernstein upper bound using the known variance of this distribution.

The loss range is \(B=1\), the risk is \(R(h)=0.25\), and \(\sigma_h^2=0.25(0.75)=0.1875\). Set \(t=\log(20)\approx 2.9957\). The square-root term is \[ \sqrt{\frac{2(0.1875)(2.9957)}{40}} =\sqrt{0.028085} \approx 0.16759. \] The linear term is \[ \frac{2(1)(2.9957)}{3(40)} \approx 0.04993. \] The radius is therefore about \(0.21752\). The observed empirical error is \(6/40=0.15\), so the bound is \(R(h)\leq 0.15+0.21752=0.36752\) with at least \(95\%\) coverage over repeated samples. The bound is valid, though conservative: a concentration bound need not be close to the realized risk on every sample.

What the Variance Term Does—and Does Not—Provide

For a fixed confidence level and sample size, the square-root term is proportional to \(\sigma_h\). If the loss is nearly constant, its variance is small and this term shrinks. The range-dependent linear term does not disappear, so a small variance does not make the stated radius identically zero.

The variance in these formulas is a population quantity. The theorem is directly usable when it is known or when a valid upper bound for it is available. Replacing it with the sample variance does not follow from this proof: a random estimate requires its own justification. Also, “fixed predictor” cannot be dropped casually. If \(h\) is selected using the same observations, these pointwise calculations alone do not establish a guarantee for the selected predictor.

Common Mistake: Applying the Wrong Tail

A frequent sign error is to define \(X_i=\ell_h(Z_i)-R(h)\), observe that \(\sum_i X_i=n(\widehat R_n(h)-R(h))\), and then use an upper-tail inequality to claim a bound on \(R(h)-\widehat R_n(h)\). That inequality controls the empirical risk being too large, not the true risk being too large. The correction is to apply the upper-tail inequality to \(-X_i=R(h)-\ell_h(Z_i)\) for the desired one-sided upper bound on \(R(h)\). For a two-sided statement, control both signs and combine the tail probabilities.

Key takeaway: For a bounded loss and a fixed predictor, Bernstein’s risk radius combines a variance-sensitive square-root term with a range-sensitive linear term. Match the sign of the centered summands to the deviation being bounded.

Check Your Understanding

Check that you can identify the assumptions, direction, and terms in a fixed-predictor Bernstein bound.

  1. For a loss in \([0,B]\), why is the centered loss bounded in absolute value by \(B\)?
  2. Which centered variables should be used to bound \(R(h)-\widehat R_n(h)\), and why?
  3. What are the variance and range parameters for a loss equal to \(B\) with probability \(p\) and zero otherwise?
  4. How does the failure probability change when two one-sided bounds, each with failure probability \(\delta/2\), are combined?
  5. Why does the fixed-predictor guarantee not by itself cover a predictor selected using the same sample?
Clinical Biostats