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.

Learner ATask 1successfulLearner BTask 2failsTask 2successfulperforms wellfails onperforms well
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.

x1observed: 0fx3 → 0x2observed: 1f′x3 → 1x3unobservedx4unobservedpossible labelpossible label
How can two possible labeling functions agree on every observed example but assign different labels to an unobserved example?
Worked 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.

  1. 1
    Count the domain

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

  2. 2
    Separate observed instances

    The training set contains m = 2 observed instances.

  3. 3
    Identify the uncertainty

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

  4. 4
    Construct a task

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

Result

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.

prediction0 or 1comparewith true labelcorrect0-1 loss: 0incorrect0-1 loss: 1evaluatematchesdoes not match
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.

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

When ERM succeeds

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

  1. 1
    Inspect the hypothesis class

    The class contains only f.

  2. 2
    Apply ERM

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

  3. 3
    Evaluate the selected hypothesis

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

Result

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.

TaskLearner Afailstask can be learnedLearner Bsucceedsevaluated byevaluated bysuccess shows
How can one learner fail on a task while another learner succeeds, without implying that the task itself cannot be learned?
  • Common mistake

    Treating the No-Free-Lunch Theorem as saying that no learning algorithm can succeed.

    What it looks like

    A learner fails on one task, so learning is impossible.

    Why it fails

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

    Do this instead

    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.

  • Common mistake

    Assuming that observed labels determine all unobserved labels.

    What it looks like

    The learner sees half of the instances in C and assumes the remaining labels are fixed by those observations.

    Why it fails

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

    Do this instead

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

  • Common mistake

    Ignoring the evaluation setting.

    What it looks like

    Discussing the theorem without specifying the classification loss.

    Why it fails

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

    Do this instead

    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}.

observed examplesprior knowledgetask assumptionsgeneralizationprediction beyondobservationsunobserved labelsnot determinedhypothesis classavailable choicesleaveconstrainssupportsmust be addressed
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. 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.

Related concepts

More concepts starting with P