Tutorials › Statistical Learning (Graduate) › Fixed-Predictor Risk Guarantees Under Bounded Loss

Concentration for Learning · Tutorial 102 of 989

Fixed-Predictor Risk Guarantees Under Bounded Loss

Learn to turn Hoeffding’s inequality into one- and two-sided confidence guarantees for the population risk of a fixed predictor.

Beginner 10 min read

What You'll Learn

  • Define population risk and empirical risk for a fixed predictor with bounded loss.
  • State the assumptions needed to apply Hoeffding’s inequality to observed losses.
  • Derive one-sided and two-sided risk guarantees at a chosen confidence level.
  • Calculate the sample size needed for a target error tolerance and failure probability.
  • Recognize why a fixed-predictor guarantee does not automatically cover a predictor selected using the same data.

From Observed Losses to Population Risk

A predictor’s performance on a sample is not its performance on the population that generated the sample. The empirical risk is calculated from observed cases and is therefore random before the sample is drawn. The population risk is the predictor’s expected loss under the population distribution. A concentration guarantee quantifies how far these two quantities can differ for one predictor fixed in advance.

This distinction is useful whenever a predictor is evaluated on an independent sample and its loss is bounded. It lets us state, for example, how many observations are needed to make the empirical risk a reliable approximation to population risk. The guarantee concerns repeated samples from the population; it does not make the population risk itself random.

Definition: Let \(Z=(X,Y)\) be a random observation with distribution \(P\), let \(h\) be a fixed predictor, and let \(\ell(h(X),Y)\) be a measurable loss satisfying \(0\leq \ell(h(X),Y)\leq 1\) with probability one. The population risk of \(h\) is \(R(h)=E[\ell(h(X),Y)]\). For an independent and identically distributed sample \(Z_1,\ldots,Z_n\) from \(P\), the empirical risk is \(\widehat R_n(h)=\frac{1}{n}\sum_{i=1}^n \ell(h(X_i),Y_i)\).

The predictor \(h\) is held fixed in this definition: it is not chosen after inspecting the sample used to calculate \(\widehat R_n(h)\). The observed losses \(W_i=\ell(h(X_i),Y_i)\) are independent, identically distributed random variables in \([0,1]\). Each has expectation \(R(h)\), so \(E[\widehat R_n(h)]=R(h)\). That equality is an expectation statement; a concentration inequality adds a probability bound on the size of the discrepancy.

Hoeffding’s Risk Guarantee

Hoeffding’s inequality for independent bounded averages gives, for independent random variables \(W_i\in[a_i,b_i]\), an exponential bound on the deviation of their average from its expectation. Here each \(W_i\) lies in \([0,1]\), and all have mean \(R(h)\). Applying the inequality to these losses gives the fixed-predictor risk guarantee below.

Theorem: Suppose \(Z_1,\ldots,Z_n\) are independent and identically distributed according to \(P\), \(h\) is fixed independently of this sample, and the measurable loss satisfies \(0\leq\ell(h(X),Y)\leq 1\) with probability one. For every \(\varepsilon>0\),
$$ P\!\left(\widehat R_n(h)-R(h)\geq\varepsilon\right)\leq e^{-2n\varepsilon^2}, \qquad P\!\left(R(h)-\widehat R_n(h)\geq\varepsilon\right)\leq e^{-2n\varepsilon^2}. $$
Consequently,
$$ P\!\left(\left|\widehat R_n(h)-R(h)\right|\geq\varepsilon\right) \leq 2e^{-2n\varepsilon^2}. $$

To see the application, set \(W_i=\ell(h(X_i),Y_i)\). Then \(E[W_i]=R(h)\) and \(\widehat R_n(h)=n^{-1}\sum_i W_i\). The one-sided inequalities are Hoeffding’s inequality applied to the upper and lower deviations of this average. The two-sided statement follows because the event that the absolute deviation is at least \(\varepsilon\) is contained in the union of the upper- and lower-deviation events. Adding their probability bounds gives \(e^{-2n\varepsilon^2}+e^{-2n\varepsilon^2}=2e^{-2n\varepsilon^2}\).

Inverting the Bound for a Confidence Statement

In applications, a tolerance \(\varepsilon\) is often chosen from a desired failure probability \(\delta\), where \(0<\delta<1\). Solving the one-sided inequality for \(\varepsilon\) gives an upper confidence bound on population risk. Solving the two-sided inequality gives an interval around empirical risk.

Result: Under the theorem’s assumptions, for \(0<\delta<1\), with probability at least \(1-\delta\),
$$ R(h)\leq \widehat R_n(h)+\sqrt{\frac{\log(1/\delta)}{2n}}. $$
Also, with probability at least \(1-\delta\),
$$ \left|R(h)-\widehat R_n(h)\right| \leq \sqrt{\frac{\log(2/\delta)}{2n}}. $$

For the one-sided statement, choose \(\varepsilon=\sqrt{\log(1/\delta)/(2n)}\). Then \(e^{-2n\varepsilon^2}=\delta\), so the probability that \(R(h)-\widehat R_n(h)\geq\varepsilon\) is at most \(\delta\). Outside that event, \(R(h)<\widehat R_n(h)+\varepsilon\), which implies the displayed weak inequality. For the two-sided statement, choose \(\varepsilon=\sqrt{\log(2/\delta)/(2n)}\). The two-sided tail bound becomes \(2e^{-2n\varepsilon^2}=\delta\); outside the deviation event, the absolute difference is at most \(\varepsilon\). These probabilities are over the random sample.

Since a loss in \([0,1]\) also implies \(0\leq R(h)\leq1\), an upper bound greater than 1 can be replaced by 1, and an interval can be intersected with \([0,1]\). This clipping preserves coverage and may make the reported range more informative.

Worked Risk Calculations

Worked Example: A One-Sided Bound for Classification Error

Suppose a fixed classifier is evaluated on \(n=100\) independent cases from the target population, and its loss is 1 for an incorrect classification and 0 otherwise. It makes 14 errors, so its empirical risk is \(\widehat R_{100}(h)=14/100=0.14\). Find a one-sided 95% upper bound for population risk.

Here \(\delta=0.05\). The one-sided radius is

$$ \sqrt{\frac{\log(1/0.05)}{2(100)}} = \sqrt{\frac{\log 20}{200}} = \sqrt{\frac{2.9957}{200}} \approx 0.1224. $$

Therefore, with probability at least \(0.95\) over repeated samples of 100 cases,

$$ R(h)\leq 0.14+0.1224=0.2624. $$

This is a conservative upper confidence guarantee, not a claim that the classifier’s risk equals 0.2624. The bound uses only the sample size, the observed empirical risk, and the fact that each loss lies in \([0,1]\).

Worked Example: Choosing a Sample Size

How large must a sample be to guarantee, for one fixed predictor with loss in \([0,1]\), that the one-sided confidence radius is at most \(0.08\) with failure probability at most \(0.01\)?

The radius condition is \(\sqrt{\log(1/\delta)/(2n)}\leq\varepsilon\). Squaring both nonnegative sides and rearranging gives

$$ n\geq\frac{\log(1/\delta)}{2\varepsilon^2} = \frac{\log 100}{2(0.08)^2} = \frac{4.60517}{0.0128} \approx 359.78. $$

Since \(n\) must be an integer, choose \(n=360\). At that sample size the radius is

$$ \sqrt{\frac{\log 100}{720}} = \sqrt{\frac{4.60517}{720}} \approx 0.07998\leq0.08. $$

The next smaller integer does not meet the requirement: \(359(0.0128)=4.5952<4.60517\), so \(n=359\) fails the squared inequality. Thus 360 is the smallest sample size that satisfies this particular Hoeffding guarantee.

Worked Example: Nonbinary Bounded Loss

For a fixed predictor, suppose the loss on a new observation is 0 with probability \(0.5\), \(0.5\) with probability \(0.3\), and 1 with probability \(0.2\). Its population risk is

$$ R(h)=0(0.5)+0.5(0.3)+1(0.2)=0.35. $$

In a sample of 100 independent observations, suppose the losses include 50 zeros, 30 values of \(0.5\), and 20 ones. These counts have positive probability under the stated distribution. The total loss is \(50(0)+30(0.5)+20(1)=35\), so \(\widehat R_{100}(h)=35/100=0.35\). At confidence level 90%, the one-sided radius is

$$ \sqrt{\frac{\log 10}{200}} = \sqrt{\frac{2.30259}{200}} \approx 0.1073. $$

The resulting upper bound is \(R(h)\leq0.35+0.1073=0.4573\), with probability at least \(0.90\) over repeated samples. The losses need not be binary: the theorem applies to any measurable loss bounded between zero and one. In this particular sample the empirical risk happens to equal the population risk, but the probability guarantee does not require that equality.

What the Guarantee Does and Does Not Say

The radius \(\sqrt{\log(1/\delta)/(2n)}\) decreases as the sample size increases and increases as the requested failure probability decreases. It does not depend on the form of the loss distribution beyond its range. That distribution-free property is useful when little is known about the losses, but it can also make the bound conservative.

The scope of the statement is just as important as its formula. It guarantees concentration for one predictor fixed independently of the observations used to evaluate it. If a predictor is chosen after looking at those same observations, the selected predictor may have unusually small empirical risk precisely because it fits random features of the sample. The fixed-predictor guarantee alone does not establish the same coverage for such a data-selected predictor.

Common pitfall: It is incorrect to calculate a one-predictor Hoeffding bound after searching many predictors on the same sample and then claim that the selected predictor inherits that bound automatically. The theorem’s assumption is that the predictor is fixed independently of the evaluation sample. A guarantee for a data-dependent selection needs additional reasoning that accounts for the selection; the single-predictor result does not do so.

A second point of interpretation is that the confidence statement is not a probability distribution for \(R(h)\). For a fixed population and fixed predictor, \(R(h)\) is a fixed number. The random object is the sample, and the statement says that the stated inequality holds for at least a specified fraction of repeated samples.

Check Your Understanding

Use the definitions and guarantees above to answer these questions.

  1. For a fixed predictor, what is the difference between population risk and empirical risk?
  2. Why does a loss in \([0,1]\) make the Hoeffding exponent in the one-sided bound equal to \(-2n\varepsilon^2\)?
  3. For \(n=50\) and failure probability \(\delta=0.1\), write the one-sided upper confidence bound in terms of the observed empirical risk.
  4. Does a one-predictor guarantee automatically apply when the predictor was selected by minimizing empirical risk on the same sample? Explain.
  5. If the observed empirical risk is \(0.92\) and a valid one-sided radius is \(0.15\), what upper bound can be reported after using the known range of population risk?
Clinical Biostats