Tutorials › Statistical Learning (Graduate) › Compactness and Continuity Conditions for ERM Consistency

ERM Consistency and Rates · Tutorial 199 of 989

Compactness and Continuity Conditions for ERM Consistency

Learn when compact parameter spaces and continuous risks guarantee consistent ERM, and how Lipschitz losses can provide the required uniform convergence.

Intermediate 10 min read

What You'll Learn

  • Define population risk and empirical risk for a parameterized model.
  • Explain why compactness and continuity ensure population and empirical minimizers exist.
  • Prove that uniform convergence and a unique population minimizer imply parameter consistency.
  • Use a finite-net argument to obtain uniform convergence for Lipschitz losses.
  • Apply the conditions to squared-error and logistic-loss examples.
  • Distinguish parameter consistency from risk consistency.

From Uniform Risk Convergence to Parameter Consistency

An estimator can have nearly optimal empirical risk without being close to the parameter that minimizes population risk. To conclude that the estimated parameter itself converges, we need a way to translate small risk differences into small parameter differences. Compactness, continuity, and a unique population minimizer provide that link: parameters a fixed distance from the minimizer must have a strictly larger population risk.

Let \(Z_1,\ldots,Z_n\) be independent observations from a common distribution \(P\), and let \(\Theta\) be a parameter space. For a loss \(\ell_\theta(z)\), define the population and empirical risks by

$$ R(\theta)=E[\ell_\theta(Z)],\qquad R_n(\theta)=\frac{1}{n}\sum_{i=1}^n \ell_\theta(Z_i). $$

An empirical risk minimizer (ERM) is a parameter \(\hat\theta_n\) that minimizes \(R_n\) over \(\Theta\). The argument below also permits approximate minimizers. Uniform convergence means that the largest risk discrepancy over the whole parameter space tends to zero:

$$ \sup_{\theta\in\Theta}|R_n(\theta)-R(\theta)| \xrightarrow{p}0. $$
Definition: A sequence \(\hat\theta_n\) is parameter-consistent for \(\theta^\star\) if \(\hat\theta_n\xrightarrow{p}\theta^\star\), meaning that for every \(\varepsilon>0\), \(P(d(\hat\theta_n,\theta^\star)\geq\varepsilon)\to 0\). Here \(d\) is the metric on the parameter space.

Why Compactness and Continuity Matter

Assume \(\Theta\) is a compact metric space and \(R\) is continuous. The extreme value theorem ensures that \(R\) attains its minimum. Suppose the minimizer \(\theta^\star\) is unique. For any fixed \(\varepsilon>0\), the set of parameters at least \(\varepsilon\) away from \(\theta^\star\) is closed and hence compact. If that set is nonempty, continuity ensures that \(R\) attains a minimum on it. Uniqueness then forces that minimum to be strictly larger than \(R(\theta^\star)\).

This gives a positive risk gap outside every fixed neighborhood of \(\theta^\star\). It is the key deterministic fact: a parameter that is far from \(\theta^\star\) cannot have population risk arbitrarily close to the minimum. Uniform convergence then ensures that empirical risks preserve this separation with high probability.

Theorem: Let \(\Theta\) be a compact metric space, and let \(R:\Theta\to\mathbb{R}\) be continuous with a unique minimizer \(\theta^\star\). Suppose \(R_n\) is continuous and \(\sup_{\theta\in\Theta}|R_n(\theta)-R(\theta)|\xrightarrow{p}0\). Let \(\hat\theta_n\) be a measurable exact minimizer of \(R_n\). Then \(\hat\theta_n\xrightarrow{p}\theta^\star\). The same conclusion holds for measurable approximate minimizers satisfying \(R_n(\hat\theta_n)\leq\inf_{\theta\in\Theta}R_n(\theta)+\delta_n\), where \(\delta_n\xrightarrow{p}0\).

Proof. Fix \(\varepsilon>0\). If no parameter lies at least \(\varepsilon\) from \(\theta^\star\), then the event \(d(\hat\theta_n,\theta^\star)\geq\varepsilon\) is empty. Otherwise, let \(C_\varepsilon=\{\theta\in\Theta:d(\theta,\theta^\star)\geq\varepsilon\}\). This is a nonempty compact set. By continuity, \(R\) attains its minimum on \(C_\varepsilon\); by uniqueness of \(\theta^\star\), that minimum exceeds \(R(\theta^\star)\). Thus

$$ g_\varepsilon =\min_{\theta\in C_\varepsilon}R(\theta)-R(\theta^\star)>0. $$

Write \(U_n=\sup_{\theta\in\Theta}|R_n(\theta)-R(\theta)|\). On the event \(d(\hat\theta_n,\theta^\star)\geq\varepsilon\), the gap definition and the uniform error bound give

$$ R_n(\hat\theta_n)\geq R(\theta^\star)+g_\varepsilon-U_n. $$

Meanwhile, the approximate-minimizer property and the fact that \(\theta^\star\in\Theta\) give

$$ R_n(\hat\theta_n) \leq \inf_{\theta\in\Theta}R_n(\theta)+\delta_n \leq R_n(\theta^\star)+\delta_n \leq R(\theta^\star)+U_n+\delta_n. $$

Combining the inequalities shows that the event \(d(\hat\theta_n,\theta^\star)\geq\varepsilon\) can occur only if \(g_\varepsilon\leq 2U_n+\delta_n\). Because \(U_n\xrightarrow{p}0\) and \(\delta_n\xrightarrow{p}0\), the probability of this last event tends to zero. This holds for every \(\varepsilon>0\), proving \(\hat\theta_n\xrightarrow{p}\theta^\star\). Continuity on compact \(\Theta\) also ensures that each \(R_n\) attains its minimum, whenever \(R_n\) is continuous. \(\square\)

Worked Examples

Worked Example: A Uniformly Perturbed Quadratic Risk

Let \(\Theta=[0,1]\), \(R(\theta)=(\theta-0.3)^2\), and \(R_n(\theta)=(\theta-0.3)^2+\theta/n\). Find the empirical minimizer and check the conditions for consistency.

The population risk is continuous and has the unique minimizer \(\theta^\star=0.3\). The empirical risk is continuous. Differentiating it gives

$$ R_n'(\theta)=2(\theta-0.3)+\frac{1}{n}. $$

The unconstrained critical point is \(0.3-1/(2n)\). Since \(R_n\) is a strictly convex quadratic, its minimizer on \([0,1]\) is that point if it is nonnegative, and otherwise the endpoint \(0\). Therefore

$$ \hat\theta_n=\max\left\{0,0.3-\frac{1}{2n}\right\}. $$

For \(n\geq 2\), this equals \(0.3-1/(2n)\), so \(\hat\theta_n\to 0.3\). Also, for every \(\theta\in[0,1]\),

$$ |R_n(\theta)-R(\theta)|=\frac{\theta}{n}\leq\frac{1}{n}. $$

Thus the empirical risks converge uniformly, the parameter space is compact, and the theorem applies. This example also shows that uniform convergence need not mean that the empirical and population minimizers are identical at finite sample sizes.

Worked Example: Bernoulli Data with Squared-Error Loss

Let \(X_1,\ldots,X_n\) be independent Bernoulli random variables with success probability \(p=0.65\). Use \(\Theta=[0,1]\) and \(\ell_\theta(x)=(x-\theta)^2\). Find the two risks and verify consistency.

Since \(X\) equals \(1\) with probability \(p\) and \(0\) otherwise, the population risk is

$$ R(\theta)=p(1-\theta)^2+(1-p)\theta^2 =(\theta-p)^2+p(1-p). $$

It is continuous and has the unique minimizer \(\theta^\star=p=0.65\). Write \(\bar X=n^{-1}\sum_{i=1}^n X_i\). Because \(X_i^2=X_i\),

$$ R_n(\theta)=\bar X(1-\theta)^2+(1-\bar X)\theta^2 =(\theta-\bar X)^2+\bar X(1-\bar X). $$

The empirical minimizer over \([0,1]\) is \(\hat\theta_n=\bar X\), since \(\bar X\in[0,1]\). Subtracting the risks gives

$$ R_n(\theta)-R(\theta)=(1-2\theta)(\bar X-p), \qquad \sup_{\theta\in[0,1]}|R_n(\theta)-R(\theta)|=|\bar X-p|. $$

The supremum equality holds because \(|1-2\theta|\leq1\) throughout the interval and equals \(1\) at its endpoints. Since \(E[\bar X]=p\) and \(\operatorname{Var}(\bar X)=p(1-p)/n\), Chebyshev's inequality yields, for every \(\eta>0\),

$$ P\left(\sup_{\theta\in[0,1]}|R_n(\theta)-R(\theta)|\geq\eta\right) =P(|\bar X-p|\geq\eta) \leq\frac{p(1-p)}{n\eta^2}\longrightarrow 0. $$

Uniform convergence holds, and \(\hat\theta_n=\bar X\xrightarrow{p}p\). Here the uniform risk calculation and the theorem agree with the direct variance calculation.

A Lipschitz Condition That Gives Uniform Convergence

Uniform convergence is an assumption in the consistency theorem, but a useful sufficient condition can be checked directly. A common approach is to control how rapidly the loss can change as the parameter changes, then cover the compact parameter space with finitely many nearby points.

Proposition: Let \(\Theta\) be a compact subset of \(\mathbb{R}^d\). Suppose \(Z_1,Z_2,\ldots\) are independent and identically distributed, \(\theta\mapsto\ell_\theta(z)\) is continuous for every \(z\), and there is a measurable \(L(Z)\) with \(E[L(Z)]<\infty\) such that \(|\ell_\theta(Z)-\ell_\eta(Z)|\leq L(Z)\|\theta-\eta\|\) almost surely for all \(\theta,\eta\in\Theta\). Suppose also \(E|\ell_{\theta_0}(Z)|<\infty\) for some \(\theta_0\in\Theta\). Then \(R\) is finite and continuous, and \(\sup_{\theta\in\Theta}|R_n(\theta)-R(\theta)|\xrightarrow{p}0\).

Proof. Compactness gives a finite diameter \(D=\sup_{\theta,\eta\in\Theta}\|\theta-\eta\|\). The Lipschitz condition implies

$$ |\ell_\theta(Z)|\leq|\ell_{\theta_0}(Z)|+D L(Z), $$

so every loss is integrable. Taking expectations in the Lipschitz inequality gives \(|R(\theta)-R(\eta)|\leq E[L(Z)]\|\theta-\eta\|\), hence \(R\) is continuous.

Fix a radius \(a>0\), and choose a finite \(a\)-net \(\theta_1,\ldots,\theta_m\) for \(\Theta\): every \(\theta\in\Theta\) is within distance \(a\) of at least one net point. For such a point \(\theta_j\), the triangle inequality and the Lipschitz condition give

$$ |R_n(\theta)-R(\theta)| \leq |R_n(\theta_j)-R(\theta_j)| +a\left(\frac{1}{n}\sum_{i=1}^n L(Z_i)+E[L(Z)]\right). $$

Taking the supremum over \(\Theta\) bounds it by the maximum discrepancy over the finite net plus the second term. For fixed \(a\), the finite maximum converges to zero in probability by the weak law of large numbers at each net point and a union bound. The weak law also gives \(n^{-1}\sum_i L(Z_i)\xrightarrow{p}E[L(Z)]\). Given any target error \(b>0\), first choose \(a\) small enough that \(2aE[L(Z)]<b/2\) (if \(E[L(Z)]=0\), this term is zero for every \(a\)); then, for that fixed net, the probability that the displayed bound exceeds \(b\) tends to zero. Therefore the supremum discrepancy converges to zero in probability. \(\square\)

Worked Example: Logistic Risk on a Compact Interval

Let \(Y_1,\ldots,Y_n\) be independent Bernoulli observations with success probability \(p=0.7\). For \(\theta\in[-2,2]\), consider the loss \(\ell_\theta(y)=\log(1+e^\theta)-y\theta\). Verify the conditions and identify the population minimizer.

The population risk is \(R(\theta)=\log(1+e^\theta)-0.7\theta\). Its first and second derivatives are

$$ R'(\theta)=\frac{e^\theta}{1+e^\theta}-0.7, \qquad R''(\theta)=\frac{e^\theta}{(1+e^\theta)^2}>0. $$

The risk is strictly convex. Solving \(R'(\theta)=0\) gives \(e^\theta=7/3\), so \(\theta^\star=\log(7/3)\), approximately \(0.847\), which lies in \([-2,2]\). It is therefore the unique minimizer on that interval.

For every \(y\in\{0,1\}\), the derivative of the loss with respect to \(\theta\) is \(e^\theta/(1+e^\theta)-y\), whose absolute value is at most \(1\). The mean value theorem thus gives \(|\ell_\theta(y)-\ell_\eta(y)|\leq|\theta-\eta|\). The loss is finite on the compact interval, so the proposition applies. More directly, writing \(\bar Y=n^{-1}\sum_iY_i\), we have

$$ R_n(\theta)-R(\theta)=-(\bar Y-0.7)\theta, \qquad \sup_{\theta\in[-2,2]}|R_n(\theta)-R(\theta)| =2|\bar Y-0.7|\xrightarrow{p}0. $$

The empirical risk is continuous and attains a minimum on the interval. Uniform convergence and the unique population minimizer therefore imply that any measurable empirical minimizer converges in probability to \(\log(7/3)\).

What the Conditions Do—and Do Not—Guarantee

The compactness and continuity assumptions serve different purposes. Compactness and continuity ensure that a minimum is attained; uniqueness gives a positive risk gap outside each neighborhood; uniform convergence ensures empirical risk cannot erase that gap. The finite-net proposition supplies one route to uniform convergence, not a consequence of compactness alone.

A common mistake is to argue that convergence of \(R_n(\theta)\) to \(R(\theta)\) for each fixed \(\theta\) automatically gives consistency of the minimizer. Pointwise convergence controls one parameter at a time, whereas an empirical minimizer is selected by comparing risks across the entire parameter space. The correction is to establish uniform convergence, or another condition strong enough to control those comparisons.

A second distinction is between parameter consistency and risk consistency. Uniform convergence and the ERM property can make the excess population risk small, but a small risk difference need not imply a small parameter difference unless the population risk separates distant parameters from its minimizer. The compactness, continuity, and uniqueness argument supplies that separation here. These conditions establish consistency, not a rate of convergence or an asymptotic distribution.

Key takeaway: On a compact parameter space, a continuous population risk with a unique minimizer has a positive risk gap outside every fixed neighborhood of that minimizer. Uniform convergence transfers this gap to empirical risk and forces ERM parameters to converge to the population minimizer.

Check Your Understanding

Use the definitions and arguments above to answer the following questions.

  1. Which step in the consistency proof uses uniqueness of the population minimizer?
  2. Why does compactness make the set of parameters at least \(\varepsilon\) from \(\theta^\star\) useful in the risk-gap argument?
  3. In the approximate ERM theorem, what condition on \(\delta_n\) is sufficient for parameter consistency?
  4. For the Bernoulli squared-error example, what is the supremum difference between empirical and population risk?
  5. In the finite-net argument, why must the net be finite when applying the weak law at its points?
Clinical Biostats