Concepts / Prior Knowledge in Machine Learning

Prior Knowledge in Machine Learning

The No-Free-Lunch Theorem rules out a learner that succeeds on every learning task.

  • Programming

The Universal-Learner Challenge

A learning algorithm receives a training set and must predict labels for examples it has not observed. The central question is whether one learner could succeed on every possible learning task. The No-Free-Lunch Theorem answers no: for every learner, there is a task on which that learner fails.

performs wellfails onperforms wellLearner ATask 1successfulLearner BTask 2failsTask 2successful
What does the theorem mean when a learner performs well on some tasks but poorly on another?

Unobserved Labels

The proof uses a subset C of the domain X with size 2m, where m is the size of the training set. The learner observes only m instances from C, which is half of the instances in C. The other instances remain unobserved.

The learner has information about the labels attached to the observed instances, but no information about the labels of the unobserved instances in this construction. Therefore, a target function f can assign labels to those unobserved instances that contradict the learner's predictions there.

possible labelpossible labelx1observed: 0fx3 → 0x2observed: 1f′x3 → 1x3unobservedx4unobserved
How can two possible labeling functions agree on every observed example but assign different labels to an unobserved example?

A four-instance version

Let C contain 2m instances with m = 2. The learner observes two instances and must predict labels for the other two.

Count the domain: Because 2m = 4, the subset C contains four instances.

Separate observed instances: The training set contains m = 2 observed instances.

Identify the uncertainty: Two instances remain unobserved. The learner has no information about their labels in the theorem's construction.

Construct a task: A target function can assign labels to the unobserved instances that contradict the learner's predictions there.

The learner's observations do not determine the labels of every instance in C, so a task can be constructed on which that learner fails.

Binary Classification and 0-1 Loss

In this setting, the theorem is applied to binary classification with the 0-1 loss. A binary classifier produces a label prediction for an instance, and the prediction is evaluated against the true label. The 0-1 loss treats the prediction as correct when it agrees with the true label and as an error when it does not.

evaluatematchesdoes not matchprediction0 or 1comparewith true labelcorrect0-1 loss: 0incorrect0-1 loss: 1
How does a binary classifier's prediction compare with the true label under the 0-1 loss?

The theorem's claim is therefore about performance measured by this classification loss. For every learner, the theorem identifies a learning task on which the learner fails under the stated binary-classification evaluation.

The ERM Choice

Empirical Risk Minimization, or ERM, selects a hypothesis using the observed examples. The theorem's source example makes the hypothesis class especially simple: H = {f}. There is only one available hypothesis, namely f, so an ERM learner using this class selects f.

use observed examplesonly available choiceevaluatetraining setobserved examplesH = {f}one hypothesisselect fERM choiceL_D(f) = 0successful task
How does an ERM learner choose a hypothesis, and why can the choice be successful for a suitable task?

When ERM succeeds

Use the source's hypothesis class H = {f} and suppose the target function has L_D(f) = 0.

Inspect the hypothesis class: The class contains only f.

Apply ERM: Because f is the only available hypothesis, the ERM learner selects f.

Evaluate the selected hypothesis: The target function has L_D(f) = 0, so the selected hypothesis has zero loss for this task.

This ERM learner succeeds on the task, even though the No-Free-Lunch Theorem says that another learner can have a task on which it fails.

Learner Failure versus Task Impossibility

A learner's failure is a statement about the match between that learner and a task. It is not a statement that the task cannot be learned by any learner. The source gives the contrasting ERM example: an ERM learner using H = {f} selects f and succeeds when L_D(f) = 0.

Thus, one learner may fail on a task constructed against it, while another learner succeeds on that same task. The No-Free-Lunch Theorem rules out a universal learner; it does not rule out learners that work well for particular tasks.

evaluated byevaluated bysuccess showsTaskLearner Afailstask can be learnedLearner Bsucceeds
How can one learner fail on a task while another learner succeeds, without implying that the task itself cannot be learned?
  • Treating the No-Free-Lunch Theorem as saying that no learning algorithm can succeed.

    The theorem says that every learner has some task on which it fails, not that every learner fails on every task.

    Fix: Separate a limitation of one learner from impossibility of the task. The ERM example succeeds for a task when H = {f} and L_D(f) = 0.

  • Assuming that observed labels determine all unobserved labels.

    In the theorem's construction, the remaining instances are unobserved, and a target function can contradict the learner's predictions there.

    Fix: Track which instances were observed and recognize the uncertainty about the rest.

  • Ignoring the evaluation setting.

    The theorem here is applied to binary classification with the 0-1 loss.

    Fix: State that predictions are evaluated by whether they agree with the true binary labels.

Why Prior Knowledge Matters

The theorem's uncertainty comes from allowing possible tasks whose labels are not determined by the observed examples. Prior knowledge matters because a learner is not successful merely by receiving data; it also needs a relationship between its available hypotheses and the task. The source's ERM example illustrates this relationship through the hypothesis class H = {f}.

leaveconstrainssupportsmust be addressedobserved examplesprior knowledgetask assumptionsgeneralizationprediction beyondobservationsunobserved labelsnot determinedhypothesis classavailable choices
How do assumptions or prior knowledge help a learner generalize beyond its observations?

Check Your Understanding

What do you think happens?

A learner observes m instances from a subset C containing 2m instances. Can the learner's observations alone determine the labels of every instance in C?

  • Yes, because half of C was observed
  • No, because the remaining instances are unobserved
  • Yes, if the learner uses ERM
  • No, because binary classification has no labels
Reveal answer

Answer: No, because the remaining instances are unobserved.

The theorem's construction leaves 2m − m instances unobserved. A target function can assign labels to those instances that contradict the learner's predictions.

MEDIUM

Explain in two or three sentences why an ERM learner using H = {f} can succeed on a task even though the No-Free-Lunch Theorem rules out a universal learner.

Hints
  • What hypothesis can the ERM learner select when f is the only member of H?
  • What does L_D(f) = 0 say about that selected hypothesis?
  • Does success on one task imply success on every task?
  1. The No-Free-Lunch Theorem says that no single learner succeeds on every possible learning task. Its proof uses a subset C of size 2m, gives the learner only m observed instances, and exploits the uncertainty about the remaining labels. In binary classification, performance is evaluated with the 0-1 loss. A learner's failure on one task does not prove that the task is impossible: another learner, such as an ERM learner using H = {f} when L_D(f) = 0, may succeed. Prior knowledge and hypothesis choices are therefore central to generalization.

Key Takeaways

  • No single learner can succeed on every possible learning task.
  • Observing only m of 2m instances leaves the labels of the remaining instances unobserved.
  • The theorem is considered here for binary classification evaluated with the 0-1 loss.
  • A learner can fail on a task while another learner succeeds on that same task.
  • Prior knowledge and the selected hypothesis class help determine which tasks a learner can handle.