Concepts / Version Space

Version Space

The version space is therefore a collection of ERM hypotheses, not necessarily a single hypothesis.

  • Programming

The Candidate Set Before Prediction

In online learning, the learner receives examples one round at a time. Before round t, it has already seen the earlier examples and can use them to eliminate hypotheses that disagree with those examples. The remaining hypotheses form the version space, written as V_t. The central question is not simply which hypothesis is correct, but which hypotheses are still consistent with everything observed so far.

V1{hA, hB, hC}V2{hA, hC}V3{hC}observe a labelobserve a label
What hypotheses remain after each newly labeled example?

ERM as Consistency

Definition

An ERM hypothesis is any hypothesis consistent with all past examples. In the online-learning setting, this means that an ERM hypothesis agrees with every labeled example received before the current round.

The version space is therefore a collection of ERM hypotheses, not necessarily a single hypothesis. Every member has survived all consistency checks performed so far. If several hypotheses remain, the Consistent algorithm may choose any one of them for the next prediction.

ConsistenthypotheseshA, hCAgreement with pastexamplesh(x) matches each observedlabelEliminatedhypotheseshBsatisfiesfails
Which hypotheses qualify as ERM hypotheses after the observed examples?

A Round of the Consistent Algorithm

The Consistent algorithm follows a strict order. First, the new instance x_t arrives. Next, the algorithm chooses any hypothesis from the current version space V_t. It uses that hypothesis to predict h(x_t). Only after the prediction does it receive the true label y_t. The algorithm then keeps the hypotheses in V_t whose predictions on x_t match y_t.

x_tnew instanceChoose h from V_tany current candidateh(x_t)predictiony_ttrue labelNew version spacematching hypotheses onlyarrives before predictionuse selected hypothesisthen receivecompare predictions with y_t
How does the algorithm use the current example to predict, test consistency, and update the version space?

Tracing Candidate Elimination

Consider a generated illustration with three hypotheses: hA, hB, and hC. Initially, before any examples have been observed, all three are candidates. Thus V_1 contains hA, hB, and hC. Suppose the first instance is x_1, and the true label is y_1. If hB predicts a label different from y_1 while hA and hC match y_1, the update removes hB and leaves V_2 containing hA and hC.

Worked example

Two Online-Learning Rounds

Track the version space when V_1 contains hA, hB, and hC. On the first example, hA and hC agree with the true label while hB disagrees. On the second example, hA disagrees while hC agrees.

  1. 1
    Round 1: receive x_1

    The algorithm receives the instance before making a prediction. It chooses a hypothesis from V_1, which contains hA, hB, and hC.

  2. 2
    Round 1: receive y_1

    After the prediction, the true label arrives. The update keeps hA and hC because their predictions on x_1 match y_1. It removes hB.

  3. 3
    Before round 2

    The updated version space is V_2 = {hA, hC}. Both remaining hypotheses are consistent with the first labeled example.

  4. 4
    Round 2: receive x_2 and y_2

    The algorithm selects from V_2. After the true label for x_2 arrives, hA is removed because it disagrees with y_2, while hC remains.

Result

After the two updates, the version space is V_3 = {hC}. The set has shrunk because each update retains only hypotheses that agree with the newly revealed true label.

Before round 1V1: hA, hB, hCBefore round 2V2: hA, hCBefore round 3V3: hCfilter using y_1filter using y_2
How does the candidate set change in size and membership as labeled examples arrive?

Selecting the Prediction Hypothesis

At the start of a round, the algorithm does not update the version space using the current example's true label, because that label has not yet been revealed. It first selects any hypothesis from V_t and predicts with that hypothesis. The selection must come from the current version space; using a hypothesis already eliminated by an earlier example would violate the Consistent algorithm's rule.

V_tcurrent candidatesSelected hypothesisany member of V_th(x_t)next predictionselect one memberevaluate on x_t
How is one hypothesis selected from the current version space for the next prediction?

Finding the First Incorrect Step

When a traced result is incorrect, locate the first point where it stops following the algorithm. There are three main checks. The instance must arrive before the prediction. The selected hypothesis must belong to V_t, and the prediction must be h(x_t). After the true label arrives, the update must compare every hypothesis's prediction on x_t with y_t and retain only the matching hypotheses.

Round orderx_t before predictionHypothesis selectionselected h belongs to V_tPredictionuse h(x_t)Version-space updatekeep predictions matchingy_tif correctif correctafter y_t arrives
At which step can a traced result first diverge from the Consistent algorithm?
  • Common mistake

    Using the true label before making the prediction

    What it looks like

    Choosing a hypothesis only after seeing y_t for the current instance

    Why it fails

    The true label is received only after the prediction.

    Do this instead

    Receive x_t, choose from V_t, predict, then receive y_t and update.

  • Common mistake

    Selecting a hypothesis that is not in V_t

    What it looks like

    Using hB after an earlier labeled example has already removed hB

    Why it fails

    The Consistent algorithm chooses from the current version space.

    Do this instead

    Check the version space immediately before the round and select one of its members.

  • Common mistake

    Updating with the selected hypothesis only

    What it looks like

    Removing or retaining candidates based only on the hypothesis used for the prediction

    Why it fails

    The update filters the hypotheses in V_t by comparing each one with y_t.

    Do this instead

    Evaluate every hypothesis in V_t on x_t and keep exactly those whose predictions match y_t.

  • Common mistake

    Comparing with the wrong label

    What it looks like

    Filtering candidates using a previous round's label instead of y_t

    Why it fails

    The current update must use the true label for the current instance.

    Do this instead

    Match each hypothesis's prediction on x_t against the newly received y_t.

Practice the Round Trace

MEDIUM

Suppose the current version space is V_t = {hA, hB}. The new instance x_t arrives. The algorithm selects hA and predicts with hA(x_t). Afterward, the true label y_t is revealed. On x_t, hA disagrees with y_t and hB agrees with y_t. What is the updated version space before the next round, and which hypothesis was used for the prediction?

Hints
  • Separate the prediction stage from the update stage.
  • The prediction uses the selected hypothesis before y_t is revealed.
  • The update retains every hypothesis in V_t whose prediction matches y_t.
Worked example

Practice Answer

V_t contains hA and hB. The algorithm predicts with hA, then the true label shows that hA disagrees and hB agrees.

  1. 1
    Prediction

    The prediction was made using hA because hA was selected from V_t before the true label arrived.

  2. 2
    Update

    The update checks both members of V_t. It removes hA because hA(x_t) disagrees with y_t and keeps hB because hB(x_t) matches y_t.

Result

The updated version space is {hB}, and hA was the hypothesis used for the prediction.

Round-by-Round Checklist

  1. 1
    Identify V_t as the hypotheses consistent with all examples observed before round t.
  2. 2
    Receive x_t before making the prediction.
  3. 3
    Choose any hypothesis from V_t.
  4. 4
    Predict using that hypothesis on x_t.
  5. 5
    Receive the true label y_t after the prediction.
  6. 6
    Keep only the hypotheses in V_t whose predictions on x_t match y_t.
  7. 7
    Use the resulting set as the version space for the next round.

Key Takeaways

  • An ERM hypothesis is consistent with every past example.
  • V_t contains the hypotheses consistent with examples observed before round t.
  • The Consistent algorithm selects any member of V_t to predict on x_t.
  • After y_t is revealed, the update keeps only hypotheses whose predictions on x_t match y_t.
  • To debug an incorrect trace, check the round order, hypothesis selection, prediction, and update in that order.

Related concepts

More concepts starting with V