Course contents 12 / 22

12 / 22 · Limit Theorems

Inequalities and concentration

Bound the chance of a large deviation using progressively stronger assumptions. Compare exact binomial tails with variance and exponential bounds, then account for choosing among several validation results.

On this page 6

An average error can be small while a large error remains possible. To control that possibility, we need a statement about a tail probability. When the full distribution is unknown, an inequality trades a limited set of assumptions for a bound that holds across many distributions.

After conditional expectation, we know how to calculate average prediction losses. Here the question is how far a random observation or sample average can move from its expectation.

Markov’s inequality#

Let WW be nonnegative with finite expectation, and choose a threshold t>0t>0. Every outcome where W≥tW\ge t contributes at least tt to WW. Using the indicator of that event,

t 1{W≥t}≤W.t\,\mathbf1_{\{W\ge t\}}\le W.

Taking expectations and dividing by the positive threshold gives Markov’s inequality:

Pr⁡(W≥t)≤E[W]t.\Pr(W\ge t)\le\frac{\mathbb E[W]}{t}.

The mean limits how much probability can be placed far above zero. The proof needs no independence or density; nonnegativity is essential. The same statement and indicator proof appear in Siegrist, Additional Properties, Markov’s Inequality.

For a running example, let X1,…,XnX_1,\ldots,X_n be independent Bernoulli variables with success probability p=2/5p=2/5, and set

Xˉn=1n∑i=1nXi.\bar X_n=\frac1n\sum_{i=1}^nX_i.

The average is nonnegative and has expectation 2/52/5. Markov therefore gives

Pr⁡(Xˉn≥1/2)≤2/51/2,=45.\begin{aligned} \Pr(\bar X_n\ge1/2)&\le\frac{2/5}{1/2},\\ &=\frac45. \end{aligned}

This direct bound does not improve with the sample size: it has used only the unchanged mean. It concerns a one-sided event. The later table will compare bounds for a different, explicitly two-sided event.

Chebyshev’s inequality#

If a real variable WW has mean μ\mu and finite variance σ2\sigma^2, its squared centered value is nonnegative. Apply Markov to that value:

Pr⁡(∣W−μ∣≥t)=Pr⁡((W−μ)2≥t2),≤E[(W−μ)2]t2,=σ2t2.\begin{aligned} \Pr(|W-\mu|\ge t) &=\Pr((W-\mu)^2\ge t^2),\\ &\le\frac{\mathbb E[(W-\mu)^2]}{t^2},\\ &=\frac{\sigma^2}{t^2}. \end{aligned}

This is Chebyshev’s inequality, valid for t>0t>0. It bounds a two-sided deviation without a distributional shape assumption. See Siegrist, Variance, Chebyshev’s Inequality.

For our independent Bernoulli observations, the variance of the sum is the sum of the variances. Dividing by the square of the sample size gives

Var⁡(Xˉn)=p(1−p)n.\operatorname{Var}(\bar X_n)=\frac{p(1-p)}n.

Choose n=150n=150 and a deviation ε=1/10\varepsilon=1/10. The variance of the average is 0.00160.0016, so

Pr⁡(∣Xˉ150−0.4∣≥0.1)≤0.16.\Pr(|\bar X_{150}-0.4|\ge0.1)\le0.16.

The bound now improves with the sample size because it uses the variance of an average. Pairwise uncorrelated observations would suffice for this variance calculation; full independence will matter for the exponential bound below.

The model also permits an exact check. Write S=150Xˉ150S=150\bar X_{150}. The event includes counts S≤45S\le45 or S≥75S\ge75, with the boundary counts included. Summing the binomial masses gives

P150=∑k=045(150k)(0.4)k(0.6)150−k+∑k=75150(150k)(0.4)k(0.6)150−k,≈0.015376202.\begin{aligned} P_{150} &=\sum_{k=0}^{45}\binom{150}{k}(0.4)^k(0.6)^{150-k}\\ &\quad+\sum_{k=75}^{150}\binom{150}{k}(0.4)^k(0.6)^{150-k},\\ &\approx0.015376202. \end{aligned}

Chebyshev is conservative for this particular law. That does not make it incorrect: the inequality must also cover distributions with much heavier tails than a bounded Bernoulli average.

Hoeffding’s inequality#

Suppose independent observations satisfy ai≤Xi≤bia_i\le X_i\le b_i almost surely. Write μn=E[Xˉn]\mu_n=\mathbb E[\bar X_n] and choose ε>0\varepsilon>0. Assume the sum of squared interval widths is positive. A one-sided bound is

Pr⁡(Xˉn−μn≥ε)≤exp⁡[−2n2ε2∑i=1n(bi−ai)2].\begin{aligned} \Pr(\bar X_n-\mu_n\ge\varepsilon) &\le\exp\left[-\frac{2n^2\varepsilon^2}{\sum_{i=1}^n(b_i-a_i)^2}\right]. \end{aligned}

The same bound applies to the lower tail. Their union therefore has at most twice this probability. This is Hoeffding’s Theorem 2 (1963), equation (2.6). If every interval has width zero, the observations are constants and the positive-deviation probability is zero instead.

For observations in [0,1][0,1], the two-sided statement simplifies to

Pr⁡(∣Xˉn−μn∣≥ε)≤2e−2nε2.\Pr(|\bar X_n-\mu_n|\ge\varepsilon) \le2e^{-2n\varepsilon^2}.

At our chosen n=150n=150 and ε=0.1\varepsilon=0.1, the upper bound is 0.0995741370.099574137. It is smaller than the variance-only bound here, while still exceeding the exact probability. Hoeffding uses boundedness and independence, but does not require identical distributions or Bernoulli observations. A bound above 11 is valid but uninformative; plotting it clipped at 11 does not turn it into an estimated probability.

Figure

One tail probability and three upper bounds

Exact probability and bounds as sample size increasesAll four curves decrease on the plotted grid. The blue exact probability lies below all three bounds. Dashed red Chebyshev decreases more slowly than the exponential bounds. Each vertical tick differs by a factor of ten.11e-11e-21e-31e-41e-540150250400Probability / boundn
  • Exact probability
  • Chebyshev
  • Hoeffding
  • Chernoff, Bernoulli

At n = 150 the exact probability is about 0.01538. Bounds are 0.16, 0.09957 and 0.08597. This comparison concerns the stipulated distribution and threshold.

Independent Bernoulli(0.4) observations; absolute mean deviation at least 0.1, including both boundary counts. Points for n = 40, 50, …, 400 are joined. The vertical scale is logarithmic; bounds are clipped at 1. Exact probabilities come from binomial sums.

All curves in the figure concern the same two-sided event with p=0.4p=0.4 and ε=0.1\varepsilon=0.1. The exact curve uses binomial sums; the additional Chernoff curve will follow from retaining the Bernoulli moment-generating function instead of bounding it only by interval width.

Where the exponent comes from#

Exponentiation turns an upper-tail event into an event about a positive variable. For λ>0\lambda>0, Markov gives

Pr⁡(Xˉn−μn≥ε)≤e−λnε E ⁣[eλ∑i(Xi−E[Xi])],=e−λnε∏i=1nE[eλ(Xi−E[Xi])].\begin{aligned} \Pr(\bar X_n-\mu_n\ge\varepsilon) &\le e^{-\lambda n\varepsilon}\, \mathbb E\!\left[e^{\lambda\sum_i(X_i-\mathbb E[X_i])}\right],\\ &=e^{-\lambda n\varepsilon}\prod_{i=1}^n \mathbb E[e^{\lambda(X_i-\mathbb E[X_i])}]. \end{aligned}

The equality uses independence. Choosing λ\lambda to minimize the resulting bound is the Chernoff method; it is an optimization of an upper bound, not a normal approximation.

For a variable supported on an interval of width cc, the centered exponential moment satisfies

log⁡E[eλ(X−E[X])]≤λ2c28.\log\mathbb E[e^{\lambda(X-\mathbb E[X])}] \le\frac{\lambda^2c^2}{8}.

Here is why the quadratic exponent is possible. Let ψ(λ)\psi(\lambda) be the logarithm on the left. Reweight the original probabilities proportionally to eλXe^{\lambda X} and normalize. Differentiating the logarithm of the exponential moment shows that ψ′′(λ)\psi''(\lambda) is the variance under this tilted distribution. Tilting changes weights, but not the interval containing XX. For any law in an interval of width cc, its variance is at most c2/4c^2/4: the expected squared distance from the interval midpoint is at most that value, and centering at its own mean only reduces it. Thus ψ′′(λ)≤c2/4\psi''(\lambda)\le c^2/4. Since ψ(0)=ψ′(0)=0\psi(0)=\psi'(0)=0, integrating this bound twice proves the displayed inequality. Bounded support justifies differentiating the exponential moments. Hoeffding’s proof of Theorem 2, equations (4.11)–(4.16) establishes the same exponential-moment bound.

For width-one intervals, substitution gives

Pr⁡(Xˉn−μn≥ε)≤exp⁡(−λnε+nλ28).\Pr(\bar X_n-\mu_n\ge\varepsilon) \le\exp\left(-\lambda n\varepsilon+\frac{n\lambda^2}{8}\right).

The exponent is minimized at λ=4ε\lambda=4\varepsilon. Substituting gives the one-sided bound; applying the same argument to the negatives of the observations and adding the two tail bounds gives the factor 22.

For Bernoulli observations we know the exponential moment exactly:

E[eλX]=1−p+peλ.\mathbb E[e^{\lambda X}]=1-p+pe^\lambda.

At an upper threshold q>pq>p, minimizing the log bound gives

Pr⁡(Xˉn≥q)≤inf⁡λ>0exp⁡(nlog⁡(1−p+peλ)−λnq),eλ∗=q(1−p)p(1−q).\begin{aligned} \Pr(\bar X_n\ge q) &\le\inf_{\lambda>0} \exp\bigl(n\log(1-p+pe^\lambda)-\lambda nq\bigr),\\ e^{\lambda_*}&=\frac{q(1-p)}{p(1-q)}. \end{aligned}

Here 0<p<q<10<p<q<1. Substituting the optimizer yields

Pr⁡(Xˉn≥q)≤e−nD(q∥p),\Pr(\bar X_n\ge q)\le e^{-nD(q\Vert p)},

where the binary divergence is

D(q∥p)=qlog⁡qp+(1−q)log⁡1−q1−p.D(q\Vert p)=q\log\frac qp+(1-q)\log\frac{1-q}{1-p}.

For a lower threshold 0<q<p0<q<p, the same calculation uses a negative λ\lambda and bounds Pr⁡(Xˉn≤q)\Pr(\bar X_n\le q). Combining q=0.3q=0.3 and q=0.5q=0.5 for our stipulated law gives 0.0859692910.085969291. This agrees with the optimized bounded-variable expression in Hoeffding’s Theorem 1, equation (2.1); here it was derived from the Bernoulli moment directly.

| Calculation for Pr⁡(∣Xˉ150−0.4∣≥0.1)\Pr(|\bar X_{150}-0.4|\ge0.1) | Value | | --- | --- | | Exact binomial probability | 0.0153762020.015376202 | | Chebyshev upper bound | 0.1600000000.160000000 | | Hoeffding upper bound | 0.0995741370.099574137 | | Optimized Bernoulli Chernoff upper bound | 0.0859692910.085969291 |

The comparison is specific to this distribution and threshold. It does not rank the methods for every regime. In particular, the Bernoulli calculation uses knowledge beyond the range and variance alone.

A first generalization bound#

A single validation result is another sample average. Let hh be a predictor fixed independently of a validation sample of size nn, and let its loss lie in [0,1][0,1]. The validation observations are independent and identically distributed from the target distribution. Denote population risk by L(h)L(h) and empirical validation risk by L^n(h)\widehat L_n(h). Hoeffding gives

Pr⁡(∣L^n(h)−L(h)∣≥ε)≤2e−2nε2.\Pr(|\widehat L_n(h)-L(h)|\ge\varepsilon) \le2e^{-2n\varepsilon^2}.

Now suppose we compare a fixed finite family H\mathcal H of MM predictors using that same validation sample. The models’ validation errors can be dependent; the union bound still gives

Pr⁡ ⁣(⋃h∈H{∣L^n(h)−L(h)∣≥ε})≤∑h∈H2e−2nε2,=2Me−2nε2.\begin{aligned} \Pr\!\left(\bigcup_{h\in\mathcal H} \{|\widehat L_n(h)-L(h)|\ge\varepsilon\}\right) &\le\sum_{h\in\mathcal H}2e^{-2n\varepsilon^2},\\ &=2M e^{-2n\varepsilon^2}. \end{aligned}

Set the right side to a desired failure probability 0<δ<10<\delta<1 and solve:

εn,M,δ=log⁡(2M/δ)2n.\varepsilon_{n,M,\delta} =\sqrt{\frac{\log(2M/\delta)}{2n}}.

With probability at least 1−δ1-\delta, all the empirical risks are within this tolerance of their population risks simultaneously. Therefore the same event covers a model selected after comparing these MM validation results. Shalev-Shwartz and Ben-David derive this finite-class guarantee in Understanding Machine Learning, Section 4.2, Corollary 4.6.

Choose n=1200n=1200, M=12M=12 and δ=0.05\delta=0.05. The tolerance is 0.0507189400.050718940. If a selected model had 108108 errors on those 12001200 validation observations, its empirical error would be 0.090.09. On the simultaneous guarantee event its population error would then be at most 0.1407189400.140718940. This count is a stipulated illustration, not a measured performance result.

Figure

Tolerance for comparing several models

Tolerance grows with candidate countThe green curve increases as candidate count grows from one to 256. A marker identifies twelve candidates and tolerance 0.05072. Independent validation sample size and failure probability are fixed.00.020.040.060.08141664256Tolerance εM
Mε
10.03921
40.04599
120.05072
640.05718
2560.06203

All candidates are specified independently of validation data. Their errors may depend on one another.

Simultaneous tolerance ε = √[log(2M/δ)/(2n)] with n = 1200 and δ = 0.05. The number M of preselected candidates uses a logarithmic axis. At M = 12, tolerance is about 0.05072. This is a deviation guarantee, not measured selection bias.

The family must be specified independently of this validation sample. Training on a separate sample is compatible with the argument: condition on that training data, then apply the bound to the independent validation data. Constructing an unrestricted new family in response to validation outcomes is not covered merely by counting the final candidates. The logarithmic factor accounts for the fixed family actually considered, not only the single model eventually reported.

What changed#

A tail probability can be controlled without computing its full distribution. Stronger usable assumptions led to smaller bounds in the constructed Bernoulli example: a variance calculation gave 0.160.16, bounded independent observations gave about 0.09960.0996, and the exact exponential moment gave about 0.08600.0860. Accounting for model selection adds a separate requirement: a simultaneous guarantee across the candidate family.

Limitations#

Nonnegativity, finite variance, boundedness and independence are distinct assumptions. None can be inferred just because an observed sample looks well behaved. If all 150150 observations are repeated copies of one Bernoulli variable, their average is that variable itself. Its variance is 0.240.24, and a deviation of at least 0.10.1 from 0.40.4 occurs with probability 11. Treating the repeated observations as independent would produce a false concentration claim.

The bounds describe probability over repeated random samples under a specified distribution. A confidence level is not a posterior probability that a fixed model’s risk has a particular value after observing data. Distribution shift, adaptive validation use and unbounded losses require different assumptions or analysis. Exact binomial sums here verify one finite example; they do not prove a distribution-free theorem or a real system’s reliability.

What you should remember#

Start by writing the exact event and checking assumptions. Markov controls nonnegative variables through their mean; Chebyshev applies it to a squared deviation. Independent bounded sums admit exponential bounds via exponential moments. Keep the factor for two tails, and use a union bound when a guarantee must cover several candidates simultaneously. A numerical upper bound and an estimated probability are different objects.

Code#

This exact integer sum checks the specified binomial event; no Monte Carlo sampling is involved:

from fractions import Fraction
import math

n = 150
numerators = [math.comb(n, k) * 2 ** k * 3 ** (n - k)
              for k in range(n + 1)]
tail = Fraction(sum(numerators[:46]) + sum(numerators[75:]), 5 ** n)
print(f"exact_tail={float(tail):.9f}")
print(f"chebyshev={24 / n:.9f} hoeffding={2 * math.exp(-n / 50):.9f}")
epsilon = math.sqrt(math.log(2 * 12 / 0.05) / (2 * 1200))
print(f"validation_epsilon={epsilon:.9f} risk_upper={0.09 + epsilon:.9f}")
exact_tail=0.015376202
chebyshev=0.160000000 hoeffding=0.099574137
validation_epsilon=0.050718940 risk_upper=0.140718940

The repository script scripts/notes/conditioning-concentration-cases.py checks the exact sums against a separate binomial recurrence, verifies the optimized exponential bound and regenerates both figures. Fixed parameters and exact event thresholds are retained in the saved results.

Next#

These bounds already show when averaging reduces the probability of a fixed-size error. The law of large numbers turns that observation into precise convergence statements and separates the guarantees provided by different assumptions.

References#