How do you prove the no free lunch theorem: for any learning algorithm A for binary classification with the 0-1 loss over a domain X, and any training size m<∣X∣/2, there is a distribution D and a labelling function f with LD(f)=0 such that with probability at least 17 over S∼Dm, LD(A(S))≥18?

Learning theory, No free lunch
Level L5 Expert. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can run the averaging argument over all labellings of a 2m-point set and then convert an expectation bound into a probability bound.

Key idea

Averaged over all 22m labellings of a 2m-point set, the algorithm has expected error at least 14 on the unseen half. Some labelling therefore has expected error ≥14, and a reverse-Markov argument gives Pr⁡[L≥18]≥17.

Steps

  1. Choose C⊂X with ∣C∣=2m. Let f1,…,fT be all T=22m labellings of C, and let Di be uniform on C with labels fi(x), so LDi(fi)=0.
  2. There are k=(2m)m possible training sequences S1,…,Sk of unlabelled points. Let Sji be Sj labelled by fi. Then max⁡iES∼DimLDi(A(S))≥1T∑i1k∑jLDi(A(Sji))≥min⁡j1T∑iLDi(A(Sji)).
  3. Fix a sequence Sj. At least p≥m points v1,…,vp of C do not occur in Sj. For any hypothesis h, LDi(h)≥12m∑r=1p1[h(vr)≠fi(vr)]≥12p∑r=1p1[h(vr)≠fi(vr)].
  4. Average over i: 1T∑iLDi(A(Sji))≥12p∑r1T∑i1[A(Sji)(vr)≠fi(vr)]≥12min⁡r1T∑i1[… ].
  5. For a fixed r, pair the labellings fi,fi′ that differ only at vr. They agree on Sj, so the algorithm outputs the same hypothesis, hence the same prediction at vr, and exactly one of the pair is wrong at vr. The average is 12. Therefore the expected error is at least 12⋅12=14.
  6. So some Di has E[LDi(A(S))]≥14. Since L∈[0,1], the reverse Markov inequality gives Pr⁡[L≥18]≥EL−1/81−1/8≥1/87/8=17.

Common mistakes

How long your answer should be

One to one and a half pages; 8–10 minutes.

Last checked on 4 December 2026.

Read this

Previous in Learning theory: Define the growth function τH(m). State and prove Sauer's lemma: if VCdim⁡(H)=d, then τH(m)≤∑i=0d(mi). Why does this matter for generalisation?
Next in Learning theory: How do you prove that for a class of functions F with values in [0,1], with probability at least 1−δ over a sample S of size m, every f∈F satisfies E[f]≤E^S[f]+2Rm(F)+ln⁡(1/δ)2m, where Rm is the expected Rademacher complexity?