Using Hoeffding's inequality, how large must a test set be so that the measured error of a fixed classifier is within of its true error with probability at least 95%?
Learning theory, Concentration inequalities
Level L2 Elementary. Length Short. Nature Mat Mathematical.
What's being asked
Whether you can apply Hoeffding's inequality to 0-1 losses and solve for .
Key idea
Let be the true error and the error measured on test points. For i.i.d. losses in , . Setting the right side to gives .
Steps
- Note that each test loss lies in , has mean , and the losses are i.i.d. because the classifier was fixed before the test set was drawn.
- Set and solve: .
- Plug in , : , so .
- Remark: halving quadruples . If you evaluate models on the same test set and report the best, a union bound replaces with .
Common mistakes
- Forgetting the factor 2 that comes from the two-sided bound.
- Applying the bound to the training error of a hypothesis chosen using that same data; the losses then depend on the choice.
- Rounding down. must be the next integer up.
How long your answer should be
Three lines of algebra and one number.
Last checked on 4 December 2026.
Read this
Previous in Learning theory: In online prediction with expert advice, what is regret, and what does it mean for an algorithm to have sublinear regret?
Next in Learning theory: What is the VC dimension of the class of closed intervals on the real line, and why?