TL;DR
A learning method picks one function from a family of functions using training data, and we want its error on new data to match its error on the training data. Rademacher complexity is a number that measures how much a family can cheat: it asks how well the best function in the family can match random plus-or-minus-one labels on your sample. A family that matches random noise easily can also memorise the real labels, so its training error can be far below its true error, which is the overfitting problem in its purest form.
Builds on: Empirical Risk Minimization, Concentration Inequalities, Bernoulli Distribution · Leads to: the random-label experiments that motivated modern generalisation theory
Where it's used
Bounding the error of a trained classifier. Before deploying a spam filter, a team wants a guarantee like "the error on new email is at most the error on our test set plus a small margin". Rademacher complexity of the filter's family of rules gives that margin. A family of simple linear rules gets a small margin; a family of very flexible rules gets a margin too large to be useful.
Explaining kernel and linear methods. Support vector machines with a bounded weight vector have a Rademacher bound that depends on the norm of the weights and the size of the data points, not on the number of features. This is why a kernel method with a huge feature space can still generalise when its weights stay small. The bound is a clean, checkable quantity, which is why textbooks use it as the standard example.
Studying deep networks. A neural network can have millions of parameters and still reach low training error. Rademacher-style bounds, once adapted to networks by controlling weight norms per layer, are one of the tools researchers use to ask when such a network can generalise. Their limits are part of the story: a 2016 study showed that large image networks can fit completely random labels, which means a capacity measure that ignores the data can be far too pessimistic.
How it works
Take a tiny instance. We have a sample of two points, and , and a family with two functions. Each function is written as the pair of values it takes on the sample:
- , so and .
- , so and .
- Draw random signs. Pick and independently, each equal to or with probability one half (a coin flip mapped to plus or minus one). There are four equally likely patterns: , , , . Check: the four probabilities add to , since .
- Score each function against the signs. For a pattern and a function, compute the average of over the two points. Take : scores , and scores . Check: a function that agrees with the signs everywhere scores .
- Keep the best function. For each pattern, keep the highest score in the family. For that is . Check: the best function is the one that fits the signs best, so this number can never be below any single function's score.
- Average over the patterns. The four best scores are for , for , for and for . Their average is . That average is the empirical Rademacher complexity of this family on this sample. Check: it lies between and .
flowchart LR S["Sample x1, x2"] --> G["Draw signs (sigma1, sigma2)"] G --> B["Best score in the family for these signs"] B --> M["Average the best scores over all four patterns"] M --> C["Empirical Rademacher complexity = 1/2"]
The number says the family can match random signs about half the time on this tiny sample. A family that could match every sign pattern perfectly would score ; a family with one fixed function would score close to .
The math
Random signs
A Rademacher variable is a random number with . Its average is zero, and that is what makes it useful: a sum of signs cancels out unless the terms are chosen to line up with the sign. Step 1 above draws such variables , one per sample point.
Step 2 in symbols
Let be the sample. The score of a function against the signs is the average of :
Here is the sign attached to point , and is the function's value there. A large score means tracks the signs.
Step 3 in symbols: the supremum
Step 3 keeps the best function, which is the supremum over the family:
The supremum is taken over the whole family , so it depends on the signs. It can be negative when every function anti-tracks the signs, which is why the average in step 4 matters.
Step 4 in symbols: the empirical Rademacher complexity
Average over all sign patterns with the expected value over :
This is the empirical Rademacher complexity. It depends on the sample and on the family, and it can be computed from data. For the tiny instance, the expectation is the average over the four patterns, giving .
Averaging over the sample as well gives the Rademacher complexity , which describes the family before any data is seen.
Why this controls the gap
For a loss with values in and a sample of size , one common form of the bound says that with probability at least , for every in the family,
Here is the true risk (the average loss on new data), is the training risk, is the family of loss functions, and is the allowed chance that the bound fails. The last term is the usual concentration term from concentration inequalities: it shrinks like . The middle term is the Rademacher complexity of the losses. The reason it appears is a symmetry argument: the largest gap between true and training risk has an expected size that can be bounded by twice the Rademacher complexity.
A bound for linear rules
Take the family of linear rules with , on inputs with . Three steps give the bound.
- For a fixed sign pattern, the best score is , by the Cauchy–Schwarz inequality.
- Averaging over signs and using Jensen's inequality (the square root is concave), , because the cross terms have zero average.
- Since , the square root is at most , so .
The bound has no dependence on the number of features, only on the weight size , the input size and the sample size .
- BR / sqrt(n) with B = R = 1
Worked examples
Family with on two points. There is only one function, so the supremum is just its score.
- The four sign patterns are , , , .
- Score for : .
- Score for : .
- Score for : .
- Score for : .
- Average the four scores: .
Interpretation: a single fixed function cannot fit the noise, because its scores cancel over all patterns. The complexity is , so this family has no room to memorise.
Take points and the family of all functions that output on those points. For any sign pattern , one of those functions equals on every point.
- Fix any sign pattern .
- Choose with for each . This is in the family.
- Its score is .
- No function can score above , since each term is at most .
- So the supremum is for every pattern, and the average over patterns is .
Interpretation: this family can fit any labels on these points. Plugging into the bound gives , and since the true risk never exceeds the bound says nothing. Complexity means the bound is vacuous.
Try it: with points and the family of all four functions on those points, what is the empirical Rademacher complexity? Answer: it is . The same argument as above applies: for any pattern, the function equal to the signs scores , and no function scores more.
A spam filter is a linear rule with , trained on emails whose feature vectors satisfy . The chance of failure is .
- Rademacher bound for linear rules: with .
- Compute , so .
- The complexity term is .
- Compute the concentration term: .
- Divide by : .
- Take the square root: .
- Add the two terms: .
Interpretation: with high confidence, the true error of the spam filter is at most its training error plus about . A filter with training error therefore has true error at most about .
Try it: the same filter is trained on emails, with the same norm bounds. What is the bound on ? Answer: .
Common mistakes and tradeoffs
It is tempting to think Rademacher complexity counts parameters. In fact it measures how well the family fits random signs on the data, which depends on weight norms, input sizes and the sample. A model with a million weights but tight norm limits can have a small complexity, and a model with few parameters but unlimited flexibility can have a large one.
It is tempting to think a small complexity means the model is good. In fact it only bounds the gap between training and true error. A family can have a small gap and still be too simple to fit the data, so training error stays high. The bound is about the gap, not about accuracy.
It is tempting to think the bound is tight. In fact the bounds are usually loose by large factors, because they must hold for every function in the family at once. The random-label experiments in the paper linked above show networks that fit random labels, which a tight complexity measure would have to penalise heavily. Many researchers therefore look for data-dependent or norm-based measures.
When to use it. Use Rademacher complexity to prove a generalisation bound for a family you can analyse, such as linear rules with norm limits, kernel methods or ensembles with bounded weights. It works for any loss and does not need the family to be finite.
When not to use it. Do not use it to choose a model on a validation set; cross-validation is cheaper and more accurate there. Do not expect it to give useful numbers for very large neural networks without extra structure.
Alternatives. The VC dimension gives a bound that depends only on the family's combinatorics and is easier to compute, but it is often looser for real-valued function classes. Gaussian complexity replaces the signs with Gaussian noise and is easier to calculate in some settings.
History
In the 1970s, Vapnik and Chervonenkis showed that the size of a family of classifiers controls how well it generalises, and they introduced the symmetrisation argument that later theory builds on. Their measure, the VC dimension, counts patterns a family can shatter, and it is distribution-free but often too coarse.
In 2001 Koltchinskii proposed penalising a model by a Rademacher-type quantity, and in 2002 Bartlett and Mendelson developed Rademacher and Gaussian complexities as general tools for proving generalisation bounds. The method caught on because it works directly with the data, applies to real-valued losses, and produces bounds that adapt to norms rather than raw parameter counts. The name comes from the Rademacher functions, the plus-or-minus-one functions studied by the mathematician Hans Rademacher in the 1920s, which are the sign patterns used here.
Recap
- A Rademacher variable is a random sign with equal chances, so its average is zero.
- The empirical Rademacher complexity averages, over random signs, the best score a family can achieve in matching them on the sample.
- Its expected version bounds the gap between true and training risk, up to a term from concentration.
- Norm-limited linear rules have , a bound that ignores the number of features.
- Next, read the overfitting lesson for the intuition behind the gap, and the random-label paper for why such bounds can be too pessimistic for deep networks.
Check yourself
QuestionWhat is the empirical Rademacher complexity of a family with a single function on a sample, if that function's values on the sample are ?Show answer
Compute the four sign patterns. For the score is . For it is . For it is . For it is . The average is . A single function has no choice to make, and its scores cancel across sign patterns, so the complexity is .
QuestionFor the linear bound , what is the bound when , and ?Show answer
Compute . Compute . Divide: . The complexity bound is .
QuestionWhy does a family that can fit every labeling of the sample give a useless generalisation bound?Show answer
Such a family has empirical Rademacher complexity , because for every sign pattern some function matches the signs exactly and scores . The bound has a term , which would be in this case. Since the true risk of a loss is at most , a bound that allows plus a positive term says nothing about the risk.
QuestionA linear family has , , and a sample of points. A learner has training risk and the failure probability is . Give the bound on the true risk, using the form in the math section.Show answer
Complexity term: . Concentration term: . Total bound: , so the true risk is at most about .
QuestionWhy does a norm limit on the weights matter more than the number of features in this bound?Show answer
The bound on depends on , the bound on the weight size, and , the bound on the input size, and on . It does not depend on the number of features. A score is , which is at most times the length of . So the weight limit caps how well the family can match random signs, however many features there are.