In our motivation of SRM in chapter 9,
we talked about wanting to use an
To keep things simple, we’ll think about
A metric space
If
One example would be the set of all functions
A milder set to target is the set of all continuous functions. If there’s a continuous function achieving the Bayes error, then this immediately guarantees that the approximation error would be zero.
For a compact metric space
Recall that if
The following result suggests that this is a reasonable (if strict) way to calculate distances between functions.
Suppose that
We have that
Even if the “target function” isn’t continuous, the approximation error could still be zero.
Consider
The absolute loss
As
Let
That is, for every
Suppose that
Let
We call a hypothesis class
The following property
is known as separating compact sets.
It establishes that
thresholding functions in a universal hypothesis class
can shatter any set,
so that
Let
If either set is empty, the result is trivial.
Otherwise, define
If
This result implies that, at least for binary classifiers,
it’s impossible to PAC-learn a universal
There might be some particular
Even when the approximation error of
As you may have heard before (probably invoked in somewhat mystical ways), classes of neural networks are universal.
A feedforward neural network (or multilayer perceptron, MLP) is a function defined hierarchically as
where
On A3, you bounded the Rademacher complexity for some such networks,
with some assumptions on
It’s worth noting now that neural networks are usually trained via stochastic gradient descent, but this non-convex optimization can be difficult: in general, it’s NP-hard, even to optimize a single ReLU unit with square loss ([GKM+21]). We’ll talk more about optimization soon.
The following result is easy to understand, and extremely simple, but is indicative of universal approximation results in general.
Let
First off, if
We’re going to construct a piecewise-linear approximation
We’ll make
We can make our piecewise-linear approximation if we start the function at
We can get that with the desired architecture by letting
i.e. the hidden layer has each neuron with weight
How good of an approximation is this
Thus
Here’s a similar result in
Let
Approximate the continuous
Notice the curse of dimensionality:
the size of the network depends exponentially on the dimension,
which for deep learning is typically at least hundreds, perhaps millions or more.
This isn’t just a proof artifact; it’s necessary to approximate arbitrary continuous functions.
The construction also needs really large weights, and has a really bad Lipschitz constant;
it also only gives an
We can actually get a sup-norm bound with only one hidden layer a different way, using the celebrated Stone-Weierstrass approximation theorem from analysis.
Let
Each
For each
For all
For each
Then
You may have heard of the Weierstrass theorem, which shows that polynomial functions are dense in
Notice that
We just need to show it satisfies the conditions of Stone-Weierstrass.
The first two are clear.
For
To show
which is one iff
Let
For any continuous target
is sufficiently accurate
so that replacing each
More generally, this general approach works if
We won’t go into depth on this perspective, but it’s definitely worth knowing it exists. [SB14], Chapter 20 overview the general basic results, but the standard classic text is [PAR94]. The short version:
Two-layer networks with threshold activations can represent all functions from
But, it takes exponential width to do that.
But, for any Boolean function that can be computed with maximal runtime
“Neural networks can do anything!!”
(You don’t hear “decision trees can do anything!!” as often, but it’s just as true….)
These results mean that, for any (continuous) function (on a compact domain) that we’d like to approximate, there is some neural net that can closely approximate that behaviour. Continuous functions also aren’t a huge limit, as in example 10.4. So, there is some neural network that can approximate “what’s the next bit in the response of a very smart human to a Unicode string of length at most 128,000 bytes.” But we can only guarantee that there’s such a network that’s very large (in parameter count and also weight norm). There’s also a really really big decision tree that can do that.
So, does ERM in a large enough hypothesis class, or SRM, or whatever other learning algorithm, necessarily generalize? Maybe not.
Also, for neural networks ERM is NP-hard; does gradient descent approximate it well? Maybe not.
But, are these constructions with enormous norms indicative of the actual norm required for functions we care about? Maybe not.
One way to help answer these questions is to characterize what kinds of functions have large norms. This is mostly beyond the scope of this course, but the typical traditional scheme is based on functions in Sobolev classes; [BAC25] has a bunch of material on this. There’s also recent work on, say, constructing Transformers to do some particular task, as an existence proof of approximation for that task (rather than universally).