Quant Memo
Advanced

Covering Numbers and Metric Entropy

VC dimension counts labelings, which only works for binary classifiers — covering numbers measure a hypothesis class's size the way you'd count how many floodlights it takes to illuminate every corner of a room, and that trick extends complexity measurement to real-valued predictions too.

Prerequisites: The VC Generalization Bound

VC dimension is a great complexity measure for classifiers that output a strict +1+1/1-1 label, because "does this class realize every labeling of these points" is a well-posed question when there are finitely many possible labelings. It breaks down for models that output a continuous number — a regression predicting a return, or a probability between 0 and 1 — because there are infinitely many possible "labelings" (any real number is a valid output), so shattering-based counting has nothing to count. Covering numbers solve this by asking a different, more general question: not "how many outputs can this class produce exactly," but "how many approximate representatives does it take to get within some tolerance ϵ\epsilon of every function in the class."

The analogy: how many floodlights to light a whole room

You want to light every corner of a large, oddly-shaped room, and any point within a floodlight's fixed radius counts as "covered," even if not lit dead-center. A tiny closet might need just one floodlight; a sprawling warehouse with many nooks needs many. The number of floodlights required — placed optimally — to guarantee no point in the room is farther than the fixed radius from some floodlight is exactly a covering number: it depends on both the room's size/shape (the hypothesis class) and the radius you're willing to tolerate (the tolerance ϵ\epsilon). Shrink the tolerable radius and you need more floodlights; that relationship, tracked as ϵ0\epsilon \to 0, is the class's metric entropy.

The formal definition

Given a hypothesis class H\mathcal{H} and a distance metric d(,)d(\cdot,\cdot) between functions (e.g., how much they disagree on average over the data), the ϵ\epsilon-covering number N(ϵ,H,d)N(\epsilon, \mathcal{H}, d) is the smallest number of functions {g1,,gN}\{g_1, \dots, g_N\} such that every hHh \in \mathcal{H} is within distance ϵ\epsilon of some gig_i:

hH,  gi  such that  d(h,gi)ϵ\forall h \in \mathcal{H}, \; \exists\, g_i \; \text{such that} \; d(h, g_i) \le \epsilon

In words: you don't need to list every function in a possibly infinite class — you just need a finite "sample set" of representative functions dense enough that nothing in the class strays farther than ϵ\epsilon from its nearest representative. Metric entropy is logN(ϵ,H,d)\log N(\epsilon, \mathcal{H}, d) — the covering number's logarithm — and it plugs into generalization bounds the same conceptual role VC dimension's ln(2n/d)\ln(2n/d) term does: it measures effective complexity, but continuously, as a function of the tolerance ϵ\epsilon, rather than as one fixed number.

Worked example 1: covering a simple interval-valued class

Let H\mathcal{H} be constant functions hc(x)=ch_c(x) = c for c[0,10]c \in [0, 10], distance d(hc,hc)=ccd(h_c, h_{c'}) = |c - c'|. At tolerance ϵ=1\epsilon = 1, representatives at c=0.5,1.5,,9.5c = 0.5, 1.5, \dots, 9.5 (10 of them) each cover a width-2 interval, so N(1,H,d)=10N(1, \mathcal{H}, d) = 10. Tighten to ϵ=0.1\epsilon = 0.1: representatives every 0.20.2 are needed, giving N(0.1,H,d)=50N(0.1, \mathcal{H}, d) = 50. The covering number grows as ϵ\epsilon shrinks — expected, since this simple 1-dimensional class has metric entropy growing only like log(1/ϵ)\log(1/\epsilon), mild growth reflecting genuinely low complexity.

Worked example 2: comparing two classes at the same tolerance

At ϵ=0.1\epsilon = 0.1, the constant-function class above needs N=50N=50 representatives. Compare to linear functions ha,b(x)=ax+bh_{a,b}(x) = ax+b over a bounded domain: with two free parameters instead of one, its covering number at the same ϵ=0.1\epsilon=0.1 scales roughly like the square of a single-parameter class's — thousands rather than tens. More free parameters means many more representatives to cover the same tolerance, making the intuitive "more parameters, more complexity" idea numerically precise, and extending smoothly to non-classification model classes.

Function explorer
-2222.8
x = 1.00f(x) = 0.000

Drag the curve above and note the shape: metric entropy typically grows like log(1/ϵ)\log(1/\epsilon) for well-behaved low-dimensional classes, which is the mild, controllable growth a useful generalization bound needs.

ε = 1: fewer, larger circles ε = 0.3: more, smaller circles
Fewer, larger circles cover the same space at loose tolerance; shrinking the tolerance forces more, smaller circles — the covering number grows as $\epsilon$ shrinks.

A covering number counts the minimum number of representative functions needed so that every function in a hypothesis class is within some tolerance ϵ\epsilon of one of them. Unlike VC dimension, this works for real-valued (not just binary) hypothesis classes, and metric entropy — the covering number's logarithm — plugs into generalization bounds as a continuous, tolerance-dependent measure of complexity.

What this means in practice

Covering numbers underpin generalization theory for regression models, kernel methods, and neural networks with continuous outputs, exactly where VC dimension's binary-labeling framework doesn't apply cleanly. "Polynomial" versus "exponential" metric entropy growth as ϵ0\epsilon \to 0 does the same complexity-control job VC dimension does for classifiers — it says how fast generalization guarantees improve with more data.

The common confusion is assuming covering numbers are just a technical restatement of VC dimension for a different notation. They answer a genuinely different question — approximate covering at a chosen tolerance ϵ\epsilon, versus exact realization of every discrete labeling — and that difference is exactly what lets covering-number-based bounds (like the Dudley entropy integral, The Dudley Entropy Integral) handle continuous-output model classes that VC theory, built for binary labels, cannot describe at all.

Related concepts

Practice in interviews

Further reading

  • van der Vaart & Wellner, Weak Convergence and Empirical Processes, ch. 2.1
ShareTwitterLinkedIn