In a typical supervised learning setting, we are given access to a dataset of samples which we assume are drawn from a distribution over . For simplicity, we will assume that is either the space or and that is either the space or .

Given a set of functions that map from and a loss function , the goal of supervised learning to find some that minimizes . For classification (when ), we commonly choose to be the zero-one loss . For regression (when ), we often choose to be the squared error . Note that we could use the absolute error instead of , but squared error is differentiable everywhere and has a few other nice properties.

One significant challenge with this objective is that we generally cannot compute or optimize this expectation directly. Instead, we need to use the dataset to estimate it. For example, we can use as an estimate of . The quality of this estimate is dependent on a few factors:

- The number of samples
- The choice of loss function . In this blog post we will primarily stick to the zero-one and squared error losses defined above
- The structure of the distribution
- The expressiveness of the function space

First, let’s consider the scenario when we fix a random element and treat as a random variable on samples . Since the are drawn independently, we can treat as a sequence of i.i.d random variables, and we can therefore apply the central limit theorem to bound the degree to which we expect to diverge from . We refer to this kind of bound as a **generalization bound**.

In this case the magnitude of this divergence is determine by the variance of the random variable . In addition to the number of samples , this variance is typically determined by the variance of the random variable itself, as well as the degree to which defines high-weight regions over that both agree with and do not agree with .

Of course, in practice we do not fix across different distributions . Instead, we use some sort of optimization procedure to select based on the samples that we have drawn from . In this situation we will need to formulate generalization bounds that depend on directly.

## Polynomial Example

Let’s start by considering a simple regression example. Say that both and are and that is a completely uniform distribution over the interval such that there is no relationship between and . Obviously, we would expect that for any function , will be consistently well above and will increase with .

Now let’s say that is the class of linear functions such that we can express any as . If , we can always draw a line that connects the two points and have . However, for large , it is likely that no line will come close to connecting the points, and for any the quantity will be close to .

Now say that we instead define to be the class of polynomials. Since for any set of points in the plane with distinct and values there always exists a degree polynomial that passes through those points, there will always exist some such that will be .

Intuitively, we can see that for this “worst case” distribution, a larger and more complex function class will exhibit a greater difference between for the that minimizes this value and for this same . The reason for this is that for any particular realization of “noise” , a larger and more complex function class has a higher probability of containing some function that can “fit” that noise.

## Rademacher Complexity

We can make this rigorous. The **Rademacher Complexity** of a function class over a distribution measures the degree to which the outputs of a function on can correlate with a sequence of i.i.d random variables that are uniformly distributed on (i.e. Rademacher random variables). That is:

Unsurprisingly, the larger the Rademacher complexity of a function class , the greater the divergence between for the that minimizes this value and for this same . If we compute the Rademacher complexity of the function class from the Rademacher complexity of , we can use this property to bound the divergence between for the that minimizes this value and for this same . Let’s note that by Talagrand’s lemma the Rademacher complexity of depends on as well as , and can be significantly larger than for faster growing loss functions (e.g. for large ).

## VC Dimension

One of the major downsides of Rademacher complexity is that it is distribution-dependent. That is, the Rademacher complexity of a function class is defined with respect to the marginal distribution over . However, in practice we may not have access to this distribution, and it could be useful to reason about how the function class will behave over the worst case distribution.

One tool for doing this is **VC Dimension**, or Vapnik-Chervonenkis Dimension. Unlike Rademacher Complexity, VC Dimension is only defined for classification. That is, we can only compute the VC dimension of function classes that map into . Both the Rademacher Complexity and VC dimension of a function class measure the expressiveness of the class, or the degree to which the “best” function in the class can generate outputs that are consistent with somewhat arbitrary (input, output) pairs. However, unlike Rademacher Complexity, VC dimension does not measure this expressiveness probabilistically.

We define the VC dimension of a function class to be the largest set of points that the function class can **shatter**, or classify in every possible way. For example, consider the class of interval functions on . That is, the class of functions that we can express as
. For the set of two points , there exists four possible labelings of that set:

, , and

For each of these labelings, we can define an interval that contains all points labelled and no points labelled . However, for any set of three distinct points ordered from smallest to largest, there exists no interval function that can generate the classification . Therefore, the VC dimension of is .

Intuitively, if the VC dimension of is very large, then even when is large it is possible for a learning algorithm to find a that has a very low sample loss even when and are independent over . That is, it is possible for and to be very different.

One important aspect of VC dimension is that only needs to be able to shatter one set of size in order to have a VC dimension of . This is a consequence of the “worst case” focus of VC dimension. In order to make claims that are distribution-agnostic, we need to focus on how a learning algorithm for performs even when the distribution is chosen adversarially.

As a consequence of this, there are many function classes that have very high or even infinite VC dimension, but have more managable Rademacher Complexity if we make even mild assumptions about (see the k-split interval classifiers in this paper for an example).

## Occam’s Razor

One thing to note about both Rademacher Complexity and VC dimension is that they tend to be correlated with the minimum number of bits we would need to uniquely identify a member of the corresponding function class. For example, consider the function class of -coefficient polynomials of degree . As increases, the VC dimension, Rademacher complexity, and number of bits required to uniquely identify each polynomial increases. This is a consequence of a much more general principle known as **Occam’s Razor**, which roughly states that simpler explanations tend to be more robust than complex explanations. There are deep information theoretic arguments for why this is the case, see this paper for more information.

## Regularization

In most modern Machine Learning applications, researchers work with extraordinarily complex function classes, such as deep neural networks or massive forests of decision trees. These function classes have extremely high or even infinite VC dimension and Rademacher Complexity. However, modern learning algorithms are capable of finding functions whose performance generalizes well regardless. One reason for this is the prevalence of **regularization** techniques, which guide learning algorithms towards lower complexity subregions of high complexity function spaces.

For example, consider the class of linear functions such that the weight vector of the model has norm . The Rademacher Complexity of this class increases with . In general, the most popular algorithms for learning the values of these weights use gradient based methods for minimizing the loss function that do not explicitly restrict their search space to vectors with small norm. However, it is quite common to add a **regularization term** and use the algorithm to minimize the loss function instead. That is, although a learning algorithm may be searching the high Rademacher complexity function space , the optimization criteria incentivizes the algorithm to prefer solutions in the low Rademacher Complexity region of linear classifiers with small .

## Resources

Most of the content in this post is from An Introduction to Computational Learning Theory by Michael J. Kearns, as well as the “Learning Real Valued Functions” and “VC dimension” course notes from Varun Kanade’s Computational Learning Theory course at Oxford.