Covering and Packing Numbers
Covering counts how many small balls hide a set, packing counts how many separated points fit inside it. Both measure the effective size of a function class at a given resolution.
Why Does This Exist?
Uniform convergence asks for one guarantee over a whole class: every function in the class has train error near test error at once. You cannot union-bound over infinitely many functions, so you discretise. Cover the class with finitely many balls of radius (a tolerance), prove the bound on the centres, then extend to every function by approximation. The price of discretisation is the covering number : how many balls you needed.
Packing numbers are the twin. They count how many points you can fit with pairwise distance above , which lower-bounds how hard the class is. Together they bracket complexity: packing says the class is at least this rich, covering says it is at most this rich. Every chaining argument and many generalisation bounds start by estimating one of them.
Prerequisite in one paragraph. You need a metric, which is a distance rule giving the separation between two points, and a ball of radius around a centre. Distance and similarity metrics covers the rules, and compactness explains when finite covers exist at all.
Think of It Like This
Tents over a field, and fence posts inside it
To count how big a field is at tent resolution, ask two questions. How many tents of fixed size cover the whole field with overlaps allowed. And how many fence posts can you plant so every pair stays ten metres apart.
Seven tents might cover a patch while only four well-spaced posts fit inside. The tent count overestimates slightly because of overlap; the post count underestimates slightly because of gaps. The true size sits between them. Refine the tent size and both counts grow, tracing how the field fills at every scale.
Where the analogy stops: fields are two-dimensional and flat. Function classes curve, and their covering counts can grow exponentially in rather than polynomially, which changes every downstream rate.
How It Actually Works
Fix a set with metric . The covering number is the smallest number of balls of radius whose union contains . An -net is the set of their centres: finitely many points within of everything. The packing number is the largest number of points in with all pairwise distances above .
They bracket each other: . In words, a maximal packing at scale is automatically an -cover, and two packed points cannot share one -ball. Metric entropy is , the log count, which is what enters generalisation bounds additively.
The workhorse estimate is volumetric. The unit Euclidean ball in dimensions satisfies . Each coordinate needs about grid points and dimensions multiply.
Worked example
Cover the ball of radius in dimensions at resolution . The bound gives . Compute , , times gives . So about million balls of radius always suffice, and . That log count is the complexity price this resolution adds to a uniform bound.
Packing gives the floor. The same volume ratio shows at least points at separation fit, so . True complexity sits between and million at this scale, and both grow exponentially in dimension, which is the curse of dimensionality in covering form.
Watch Out For
Quoting a covering number in the wrong metric
A class can have a tiny covering number under the sup norm over fixed points but an enormous one under the true sup over all inputs. Plugging the empirical count into a bound that needs the population count understates complexity and produces a guarantee that fails on new points.
Fix: match the metric to the theorem. Chaining with Rademacher needs the empirical cover; uniform laws need the sup cover. Name the metric every time.
Treating log N as N in the bound
Generalisation bounds pay , not . With million and , the correct price is . Using directly gives , vacuous nonsense that sends people hunting for more data when the bound was simply misread.
Fix: always take the log first. Metric entropy is the currency, not the raw count.
The Quick Version
- Covering counts balls hiding a set at resolution ; packing counts -separated points inside it.
- They bracket: a maximal packing is a cover, and packed points need distinct small balls.
- A 5-dimensional unit ball needs between 100,000 and 4.1 million balls of radius 0.10.
- Bounds pay metric entropy , which is 15.2 in that example, not itself.
- Always name the metric, because the same class has wildly different covers under different distances.