The key to understanding why no algorithm can “learn any function” from only a finite number of examples lies at the intersection of computational learning theory and the No Free Lunch (NFL) theorems. While the NFL theorems are often invoked in the context of optimization and machine learning, their underlying implications are broad enough to address the notion of a universal learner. Let’s break down the reasoning:
- Formalizing the Problem:
What does it mean to “learn any function”?Typically, a learning algorithm is a procedure that, given a set of input-output examples drawn from an unknown functionf:X→Yf: X \to Yf:X→Y, attempts to produce a hypothesishhhthat approximatesfff. Saying an algorithm can learn “any function” suggests that there are no restrictions on the function’s complexity, its domain, its range, or the distribution of examples. In other words, the function might be arbitrarily defined, with no regularity or structure.
Finite number of examples:To show that an algorithm can learn a function from a finite number of examples, we must show that there is some finite set of data from which the algorithm can deduce the function with high confidence or even perfectly. This requires the learner to have a strategy that will generalize beyond the observed samples.
What does it mean to “learn any function”?Typically, a learning algorithm is a procedure that, given a set of input-output examples drawn from an unknown functionf:X→Yf: X \to Yf:X→Y, attempts to produce a hypothesishhhthat approximatesfff. Saying an algorithm can learn “any function” suggests that there are no restrictions on the function’s complexity, its domain, its range, or the distribution of examples. In other words, the function might be arbitrarily defined, with no regularity or structure.
Finite number of examples:To show that an algorithm can learn a function from a finite number of examples, we must show that there is some finite set of data from which the algorithm can deduce the function with high confidence or even perfectly. This requires the learner to have a strategy that will generalize beyond the observed samples.
- The Role of Inductive Bias:
Inductive bias:Every learning algorithm that generalizes beyond its training data must have some inductive bias—an assumption or preference for one type of function over another. Without such bias, the algorithm cannot reliably choose between infinitely many hypotheses that explain the observed data equally well. For instance, if you observe two points and try to fit a function that passes through them, infinitely many functions can do so. To prefer a “simple” function (like a linear function) requires a bias towards simplicity.
Significance of bias:If no assumptions are made about the class of functions (e.g., smoothness, continuity, complexity limits, etc.), then the space of possible functions is astronomically large—even infinite for typical input domains. Without bias, no finite number of examples is sufficient to confidently extrapolate to unobserved points.
Inductive bias:Every learning algorithm that generalizes beyond its training data must have some inductive bias—an assumption or preference for one type of function over another. Without such bias, the algorithm cannot reliably choose between infinitely many hypotheses that explain the observed data equally well. For instance, if you observe two points and try to fit a function that passes through them, infinitely many functions can do so. To prefer a “simple” function (like a linear function) requires a bias towards simplicity.
Significance of bias:If no assumptions are made about the class of functions (e.g., smoothness, continuity, complexity limits, etc.), then the space of possible functions is astronomically large—even infinite for typical input domains. Without bias, no finite number of examples is sufficient to confidently extrapolate to unobserved points.
- The No Free Lunch Theorems:
What NFL says (in brief):The No Free Lunch theorems, roughly speaking, state that when performance is averaged over all possible target functions (or problem distributions), every learning algorithm has the same expected performance. Put differently, without any restriction on the set of functions you consider equally likely, no algorithm outperforms random guessing on average.
Implication for universal learning:If you consider the class of "all possible functions" to be equally probable, the NFL results imply that no matter what clever strategy you employ, you can’t, on average, get better results than any other strategy over the entire function class. Any algorithm that appears to do well on some subset of functions will do proportionally poorly on others.
What NFL says (in brief):The No Free Lunch theorems, roughly speaking, state that when performance is averaged over all possible target functions (or problem distributions), every learning algorithm has the same expected performance. Put differently, without any restriction on the set of functions you consider equally likely, no algorithm outperforms random guessing on average.
Implication for universal learning:If you consider the class of "all possible functions" to be equally probable, the NFL results imply that no matter what clever strategy you employ, you can’t, on average, get better results than any other strategy over the entire function class. Any algorithm that appears to do well on some subset of functions will do proportionally poorly on others.
- Attempting a Proof by Contradiction:
Assume an algorithm that learns any function from finite samples exists:Suppose we have an algorithmAAAthat, given a finite number of input-output pairs, can identify any function from an unrestricted class of functions. This implies that after seeing some finite set of examples,AAAconsistently selects the correct function or something indistinguishably close.
Consider arbitrary and pathological functions:Because we said “any function,” we must consider bizarre, adversarial functions. For instance, define a functionfffthat behaves like a known simple function on all observed inputs but changes unpredictably on all unseen inputs. IfAAAuses a finite number of samples, a carefully chosen function can always differ fromAAA’s hypothesis outside those samples. There’s no finite set of observations that can pin down such a function unless we limit the function class.
Contradiction with NFL:The existence ofAAAthat works for all functions would contradict the NFL theorem’s statement that no single learner can be optimal (or even generally successful) across the entire space of problems. The uniform distribution over all functions ensures there’s no “best” learner that works well on average. IfAAAexisted, it would be an outlier that can handle even pathological cases—implying a universal superiority that NFL forbids.
Assume an algorithm that learns any function from finite samples exists:Suppose we have an algorithmAAAthat, given a finite number of input-output pairs, can identify any function from an unrestricted class of functions. This implies that after seeing some finite set of examples,AAAconsistently selects the correct function or something indistinguishably close.
Consider arbitrary and pathological functions:Because we said “any function,” we must consider bizarre, adversarial functions. For instance, define a functionfffthat behaves like a known simple function on all observed inputs but changes unpredictably on all unseen inputs. IfAAAuses a finite number of samples, a carefully chosen function can always differ fromAAA’s hypothesis outside those samples. There’s no finite set of observations that can pin down such a function unless we limit the function class.
Contradiction with NFL:The existence ofAAAthat works for all functions would contradict the NFL theorem’s statement that no single learner can be optimal (or even generally successful) across the entire space of problems. The uniform distribution over all functions ensures there’s no “best” learner that works well on average. IfAAAexisted, it would be an outlier that can handle even pathological cases—implying a universal superiority that NFL forbids.
- Why Restricting the Hypothesis Space Matters:
By restricting the class of functions, you can “escape” NFL:In practice, we do escape the NFL scenario by assuming certain regularities. For example, if we assume the target function belongs to a certain well-defined class (like linear functions, low-degree polynomials, or functions representable by a finite-size neural network with bounded complexity), then we can produce learning guarantees. VC theory, PAC learning, and related frameworks show that within a restricted hypothesis space, finite sample complexity suffices.
Without restrictions, no proof can salvage universal learning:Without placing constraints on the target function’s complexity or probability distribution, no known theoretical construction allows finite-sample identification of arbitrary functions.
By restricting the class of functions, you can “escape” NFL:In practice, we do escape the NFL scenario by assuming certain regularities. For example, if we assume the target function belongs to a certain well-defined class (like linear functions, low-degree polynomials, or functions representable by a finite-size neural network with bounded complexity), then we can produce learning guarantees. VC theory, PAC learning, and related frameworks show that within a restricted hypothesis space, finite sample complexity suffices.
Without restrictions, no proof can salvage universal learning:Without placing constraints on the target function’s complexity or probability distribution, no known theoretical construction allows finite-sample identification of arbitrary functions.
- Conclusion:
To prove that no universal algorithm exists that can learn any arbitrary function from a finite number of examples, one can argue from the No Free Lunch perspective:
State that if such an algorithm existed, it would defy the NFL theorem, which ensures that averaged over all functions, no algorithm outperforms random guessing.
Highlight that without inductive bias or constraints on the hypothesis space, the algorithm cannot distinguish among infinitely many candidate functions that fit the observed finite data.
Show that to “pick the right function” from an utterly unconstrained set would require either an infinite amount of data or prior structural assumptions about the function.
State that if such an algorithm existed, it would defy the NFL theorem, which ensures that averaged over all functions, no algorithm outperforms random guessing.
Highlight that without inductive bias or constraints on the hypothesis space, the algorithm cannot distinguish among infinitely many candidate functions that fit the observed finite data.
Show that to “pick the right function” from an utterly unconstrained set would require either an infinite amount of data or prior structural assumptions about the function.
Thus, the NFL theorems serve as a high-level impossibility result: they tell us that if we consider learning in the most general, unconstrained sense, no finite set of samples and no algorithm can guarantee success across all imaginable target functions.