Understanding Machine Learning III: The No-Free-Lunch TheoremTextbook
Motivation
Missions I and II of this series showed that finite hypothesis classes are learnable, with and without the realizability assumption, by empirical risk minimization. Chapter 5 of Shalev-Shwartz and Ben-David, Understanding Machine Learning: From Theory to Algorithms (doi:10.1017/CBO9781107298019) asks the converse question: is prior knowledge, in the form of a restricted hypothesis class, really necessary? Could there be a universal learner, an algorithm that, given enough examples from any distribution, outputs a predictor of low risk? The No-Free-Lunch theorem (Theorem 5.1) answers no: for binary classification with the 0–1 loss over a domain , for every learning algorithm and every training-set size smaller than there is a distribution on which the learner fails with probability at least , even though that distribution is perfectly predictable by some function , so that another learner (ERM over ) succeeds. The consequence for the framework is Corollary 5.2: over an infinite domain, the class of all functions is not PAC learnable. This is the first lower bound of the book and the reason the rest of it is about the complexity of hypothesis classes rather than about universal algorithms.
Setting
The framework is the UnderstandingML_Framework module of Mission I, cited as a reference. Binary classification over a domain uses examples in , hypotheses and the 0–1 loss, so the risk of under a distribution over is , computed as the integral of the 0–1 loss. A learner is a function from samples of each size to hypotheses, and a sample of size has the law . PAC learnability of a class (Definition 3.1) requires a sample-complexity function and a learner such that for every , every distribution over and every measurable labeling function realizable by , samples of size yield with probability at least .
Two conventions specific to this mission. The domain is assumed to have measurable singletons (the book's Remark 3.1 assumes away measurability issues); this makes the finitely supported distributions of the proof honest probability measures and makes every under them a genuine integral. And " smaller than " is written in the extended natural numbers, so that an infinite domain satisfies it for every .
Formalization targets
Goal: Theorem 5.1 (No-Free-Lunch)
Let be any learning algorithm for binary classification with respect to the 0–1 loss over a domain with measurable singletons, and let be a training-set size with . Then there exists a probability distribution over such that
- there is a measurable with ;
- there is a measurable set of samples of size with on which .
Milestones
Lemma B.1 (Appendix B). If takes values in and , then for every , , and consequently .
Equation (5.2). Under the hypotheses of Theorem 5.1 there are and a measurable with and .
Corollary 5.2. For an infinite domain with measurable singletons, the class of all functions is not PAC learnable.
Two further items: Exercise 5.1, the passage from an expectation of at least to a probability of at least of exceeding for a -valued variable; and Exercise 5.3, the -fold version of Equation (5.2), with bound when , and is nonempty.
Significance
The No-Free-Lunch theorem is the book's first impossibility result and the conceptual pivot of Part I: it shows that learnability is a property of the pair (hypothesis class, learner) and not of the learner alone, and it motivates the bias–complexity tradeoff of §5.2 and the VC-dimension of Chapter 6, whose lower bound (Theorem 6.7, the "only if" direction of the fundamental theorem) is proved by the same symmetrization argument. Corollary 5.2 is the statement that the class of all functions has infinite sample complexity, the negative half of the characterization of learnable classes.
Nothing here is machine-checked. The proof is combinatorial and elementary but has real content for a formalization: a finite subset of the domain, the labelings of , the uniform distribution on labeled by each of them, an exchange of a maximum, an average and a minimum over labelings and sample sequences, and a pairing argument on labelings that differ at exactly one unseen point. Lemma B.1 is a reverse Markov inequality for bounded variables that later chapters also use.
Difficulty
Lemma B.1 is Markov's inequality applied to and is the entry point; Exercise 5.1 is its instance with and , giving , together with the inclusion of in . Theorem 5.1 follows from Equation (5.2) and Exercise 5.1 once one knows that is, under the finitely supported , almost everywhere equal to a measurable function with values in ; the set is the intersection of the event with the finite support of , which is measurable because singletons are. Equation (5.2) is the heart of the mission. One picks of size (available because ), lets be uniform on labeled by the -th function extended by off , and computes as an average over the sequences of instances, which requires identifying as a finitely supported measure on sequences, that is, the product of finitely supported measures. The inequalities (5.4)–(5.6) exchange max, average and min and restrict to the unseen points, and the pairing argument shows that for each unseen point the average over of the indicator that errs on it is exactly . Exercise 5.3 is the same argument with , where at least points are unseen. Corollary 5.2 takes , , and a set of size in the infinite domain, and derives the contradiction from Theorem 5.1 via the identification of for uniform on labeled by with the true error of Definition 3.1, where is uniform on ; the case is handled separately with a single point.
Formalization scope
The items are stated in the joint-distribution form of the book's Chapter 5, with over and the risk under the 0–1 loss, rather than in the form of Definition 3.1; Corollary 5.2 is the bridge and is stated with the framework's PACLearnable. Witness labeling functions are required to be measurable, because a non-measurable would make true by Lean's convention for non-integrable functions rather than by content. Clause (2) of Theorem 5.1 is stated in the inner form (a measurable set of probability at least inside the event) rather than as a lower bound on the outer measure of the event, which for a non-measurable event would be the weaker statement. The size condition uses ENat.card, so infinite domains satisfy it. Learners are deterministic functions of the sample; the book's argument goes through for randomized learners by averaging, but the framework does not model them.
Trivializing readings are excluded: the distribution must be a probability measure, the failing set must be measurable with an honest lower bound, and the witness must be measurable. Welcome contributions: the finitely supported product law on sequences, the averaging identity (5.3), and the pairing argument on labelings of .
Selected references
- S. Shalev-Shwartz, S. Ben-David, Understanding Machine Learning: From Theory to Algorithms, Cambridge University Press, 2014, Chapter 5 and Appendix B. doi:10.1017/CBO9781107298019
- D. H. Wolpert, W. G. Macready, No free lunch theorems for optimization, IEEE Transactions on Evolutionary Computation 1(1), 1997. doi:10.1109/4235.585893
- A. Ehrenfeucht, D. Haussler, M. Kearns, L. Valiant, A general lower bound on the number of examples needed for learning, Information and Computation 82(3), 1989. doi:10.1016/0890-5401(89)90002-3
- V. N. Vapnik, Statistical Learning Theory, Wiley, 1998.