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 be nonnegative with finite expectation, and choose a threshold . Every outcome where contributes at least to . Using the indicator of that event,
Taking expectations and dividing by the positive threshold gives Markov’s inequality:
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 be independent Bernoulli variables with success probability , and set
The average is nonnegative and has expectation . Markov therefore gives
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 has mean and finite variance , its squared centered value is nonnegative. Apply Markov to that value:
This is Chebyshev’s inequality, valid for . 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
Choose and a deviation . The variance of the average is , so
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 . The event includes counts or , with the boundary counts included. Summing the binomial masses gives
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 almost surely. Write and choose . Assume the sum of squared interval widths is positive. A one-sided bound is
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 , the two-sided statement simplifies to
At our chosen and , the upper bound is . 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 is valid but uninformative; plotting it clipped at does not turn it into an estimated probability.
One tail probability and three upper bounds
- 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.
All curves in the figure concern the same two-sided event with and . 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 , Markov gives
The equality uses independence. Choosing 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 , the centered exponential moment satisfies
Here is why the quadratic exponent is possible. Let be the logarithm on the left. Reweight the original probabilities proportionally to and normalize. Differentiating the logarithm of the exponential moment shows that is the variance under this tilted distribution. Tilting changes weights, but not the interval containing . For any law in an interval of width , its variance is at most : the expected squared distance from the interval midpoint is at most that value, and centering at its own mean only reduces it. Thus . Since , 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
The exponent is minimized at . 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 .
For Bernoulli observations we know the exponential moment exactly:
At an upper threshold , minimizing the log bound gives
Here . Substituting the optimizer yields
where the binary divergence is
For a lower threshold , the same calculation uses a negative and bounds . Combining and for our stipulated law gives . 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 | Value | | --- | --- | | Exact binomial probability | | | Chebyshev upper bound | | | Hoeffding upper bound | | | Optimized Bernoulli Chernoff upper bound | |
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 be a predictor fixed independently of a validation sample of size , and let its loss lie in . The validation observations are independent and identically distributed from the target distribution. Denote population risk by and empirical validation risk by . Hoeffding gives
Now suppose we compare a fixed finite family of predictors using that same validation sample. The models’ validation errors can be dependent; the union bound still gives
Set the right side to a desired failure probability and solve:
With probability at least , all the empirical risks are within this tolerance of their population risks simultaneously. Therefore the same event covers a model selected after comparing these validation results. Shalev-Shwartz and Ben-David derive this finite-class guarantee in Understanding Machine Learning, Section 4.2, Corollary 4.6.
Choose , and . The tolerance is . If a selected model had errors on those validation observations, its empirical error would be . On the simultaneous guarantee event its population error would then be at most . This count is a stipulated illustration, not a measured performance result.
Tolerance for comparing several models
| M | ε |
|---|---|
| 1 | 0.03921 |
| 4 | 0.04599 |
| 12 | 0.05072 |
| 64 | 0.05718 |
| 256 | 0.06203 |
All candidates are specified independently of validation data. Their errors may depend on one another.
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 , bounded independent observations gave about , and the exact exponential moment gave about . 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 observations are repeated copies of one Bernoulli variable, their average is that variable itself. Its variance is , and a deviation of at least from occurs with probability . 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#
- Kyle Siegrist, Additional Properties of Expected Value, Markov’s Inequality: nonnegative-variable tail bound and indicator proof.
- Kyle Siegrist, Variance, Chebyshev’s Inequality: the centered second-moment bound and its conditions.
- Wassily Hoeffding, Probability Inequalities for Sums of Bounded Random Variables, Journal of the American Statistical Association 58(301), 13–30, 1963. Theorems 1–2, equations (2.1), (2.3), (2.6), and Section 4, equations (4.11)–(4.16).
- Shai Shalev-Shwartz and Shai Ben-David, Understanding Machine Learning: From Theory to Algorithms, Cambridge University Press, 2014, Section 4.2, Lemma 4.5 and Corollary 4.6: bounded-loss concentration and finite-family uniform guarantees.