Measure of complexity of real-valued functions
In computational learning theory (machine learning and theory of computation), Rademacher complexity, named after Hans Rademacher, measures richness of a class of sets with respect to a probability distribution. The concept can also be extended to real valued functions.
Definitions
Rademacher complexity of a set
Given a set
, the Rademacher complexity of A is defined as follows:
![{\displaystyle \operatorname {Rad} (A):={\frac {1}{m}}\mathbb {E} _{\sigma }\left[\sup _{a\in A}\sum _{i=1}^{m}\sigma _{i}a_{i}\right]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/b520e7c20bf59308973ac2589b1eb6351e6cfb76)
where
are independent random variables drawn from the Rademacher distribution i.e.
for
, and
. Some authors take the absolute value of the sum before taking the supremum, but if
is symmetric this makes no difference.
Rademacher complexity of a function class
Let
be a sample of points and consider a function class
of real-valued functions over
. Then, the empirical Rademacher complexity of
given
is defined as:
![{\displaystyle \operatorname {Rad} _{S}({\mathcal {F}})={\frac {1}{m}}\mathbb {E} _{\sigma }\left[\sup _{f\in {\mathcal {F}}}\left|\sum _{i=1}^{m}\sigma _{i}f(z_{i})\right|\right]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/6b8a236c0dc1829ff7ac6f15f81a0e50b201c704)
This can also be written using the previous definition:

where
denotes function composition, i.e.:

The worst case empirical Rademacher complexity is
Let
be a probability distribution over
. The Rademacher complexity of the function class
with respect to
for sample size
is:
![{\displaystyle \operatorname {Rad} _{P,m}({\mathcal {F}}):=\mathbb {E} _{S\sim P^{m}}\left[\operatorname {Rad} _{S}({\mathcal {F}})\right]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/dd212605c97db2d5900194fb7b4dc05a6c4cb160)
where the above expectation is taken over an identically independently distributed (i.i.d.) sample
generated according to
.
Intuition
The Rademacher complexity is typically applied on a function class of models that are used for classification, with the goal of measuring their ability to classify points drawn from a probability space under arbitrary labellings. When the function class is rich enough, it contains functions that can appropriately adapt for each arrangement of labels, simulated by the random draw of
under the expectation, so that this quantity in the sum is maximised.
Examples
1.
contains a single vector, e.g.,
. Then:

The same is true for every singleton hypothesis class.
2.
contains two vectors, e.g.,
. Then:
![{\displaystyle {\begin{aligned}\operatorname {Rad} (A)&={1 \over 2}\cdot \left({1 \over 4}\cdot \max(1+1,1+2)+{1 \over 4}\cdot \max(1-1,1-2)+{1 \over 4}\cdot \max(-1+1,-1+2)+{1 \over 4}\cdot \max(-1-1,-1-2)\right)\\[5pt]&={1 \over 8}(3+0+1-2)={1 \over 4}\end{aligned}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/648d58d1aa685edcb645203422b9514b043a100d)
Using the Rademacher complexity
The Rademacher complexity can be used to derive data-dependent upper-bounds on the learnability of function classes. Intuitively, a function-class with smaller Rademacher complexity is easier to learn.
Bounding the representativeness
In machine learning, it is desired to have a training set that represents the true distribution of some sample data
. This can be quantified using the notion of representativeness. Denote by
the probability distribution from which the samples are drawn. Denote by
the set of hypotheses (potential classifiers) and denote by
the corresponding set of error functions, i.e., for every hypothesis
, there is a function
, that maps each training sample (features,label) to the error of the classifier
(note in this case hypothesis and classifier are used interchangeably). For example, in the case that
represents a binary classifier, the error function is a 0–1 loss function, i.e. the error function
returns 0 if
correctly classifies a sample and 1 else. We omit the index and write
instead of
when the underlying hypothesis is irrelevant. Define:
– the expected error of some error function
on the real distribution
;
– the estimated error of some error function
on the sample
.
The representativeness of the sample
, with respect to
and
, is defined as:

Smaller representativeness is better, since it provides a way to avoid overfitting: it means that the true error of a classifier is not much higher than its estimated error, and so selecting a classifier that has low estimated error will ensure that the true error is also low. Note however that the concept of representativeness is relative and hence can not be compared across distinct samples.
The expected representativeness of a sample can be bounded above by the Rademacher complexity of the function class: If
is a set of functions with range within
, then
![{\displaystyle \operatorname {Rad} _{P,m}({\mathcal {F}})-{\sqrt {\frac {\ln 2}{2m}}}\leq \mathbb {E} _{S\sim P^{m}}[\operatorname {Rep} _{P}({\mathcal {F}},S)]\leq 2\operatorname {Rad} _{P,m}({\mathcal {F}})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/5c54a96b3957b11d3baf57f368335076ee2aecd6)
Furthermore, the representativeness is concentrated around its expectation: For any
, with probability
,![{\displaystyle \operatorname {Rep} _{P}({\mathcal {F}},S)\in \mathbb {E} _{S\sim P^{m}}[\operatorname {Rep} _{P}({\mathcal {F}},S)]\pm \epsilon }](https://wikimedia.org/api/rest_v1/media/math/render/svg/53bb27d44753631c62604341e209efa805c691a7)
Bounding the generalization error
The Rademacher complexity is a theoretical justification for empirical risk minimization.
When the error function is binary (0-1 loss), for every
,

with probability at least
.
There exists a constant
, such that when the error function is squared
, and the function class
consists of functions with range within
, then for any 
with probability at least
.
Oracle inequalities
Let the Bayes risk
, where
can be any measurable function.
Let the function class
be split into "complexity classes"
, where
are levels of complexity. Let
be real numbers. Let the complexity measure function
be defined such that
.
For any dataset
, let
be a minimizer of
. If
then we have the oracle inequality
Define
. If we further assume
and
then we have the oracle inequality 
Bounding the Rademacher complexity
Since smaller Rademacher complexity is better, it is useful to have upper bounds on the Rademacher complexity of various function sets. The following rules can be used to upper-bound the Rademacher complexity of a set
.
1. If all vectors in
are translated by a constant vector
, then Rad(A) does not change.
2. If all vectors in
are multiplied by a scalar
, then Rad(A) is multiplied by
.
3.
.
4. (Kakade & Tewari Lemma) If all vectors in
are operated by a Lipschitz function, then Rad(A) is (at most) multiplied by the Lipschitz constant of the function. In particular, if all vectors in
are operated by a contraction mapping, then Rad(A) strictly decreases.
5. The Rademacher complexity of the convex hull of
equals Rad(A).
6. (Massart Lemma) The Rademacher complexity of a finite set grows logarithmically with the set size. Formally, let
be a set of
vectors in
, and let
be the mean of the vectors in
. Then:

In particular, if
is a set of binary vectors, the norm is at most
, so:

Let
be a set family whose VC dimension is
. It is known that the growth function of
is bounded as:
- for all
: 
This means that, for every set
with at most
elements,
. The set-family
can be considered as a set of binary vectors over
. Substituting this in Massart's lemma gives:

With more advanced techniques (Dudley's entropy bound and Haussler's upper bound) one can show, for example, that there exists a constant
, such that any class of
-indicator functions with Vapnik–Chervonenkis dimension
has Rademacher complexity upper-bounded by
.
The following bounds are related to linear operations on
– a constant set of
vectors in
.
1. Define
the set of dot-products of the vectors in
with vectors in the unit ball. Then:

2. Define
the set of dot-products of the vectors in
with vectors in the unit ball of the 1-norm. Then:

The following bound relates the Rademacher complexity of a set
to its external covering number – the number of balls of a given radius
whose union contains
. The bound is attributed to Dudley.
Suppose
is a set of vectors whose length (norm) is at most
. Then, for every integer
:

In particular, if
lies in a d-dimensional subspace of
, then:

Substituting this in the previous bound gives the following bound on the Rademacher complexity:

Gaussian complexity
Gaussian complexity is a similar complexity with similar physical meanings, and can be obtained from the Rademacher complexity using the random variables
instead of
, where
are Gaussian i.i.d. random variables with zero-mean and variance 1, i.e.
. Gaussian and Rademacher complexities are known to be equivalent up to logarithmic factors.
Equivalence of Rademacher and Gaussian complexity
Given a set
then it holds that:

Where
is the Gaussian Complexity of A. As an example, consider the rademacher and gaussian complexities of the L1 ball. The Rademacher complexity is given by exactly 1, whereas the Gaussian complexity is on the order of
(which can be shown by applying known properties of suprema of a set of subgaussian random variables).
References
- Peter L. Bartlett, Shahar Mendelson (2002) Rademacher and Gaussian Complexities: Risk Bounds and Structural Results. Journal of Machine Learning Research 3 463–482
- Giorgio Gnecco, Marcello Sanguineti (2008) Approximation Error Bounds via Rademacher's Complexity. Applied Mathematical Sciences, Vol. 2, 2008, no. 4, 153–176