Concepts / PAC Learnability

PAC Learnability

The finite-class PAC result explains when this sample-based selection is reliable: under realizability and with a sufficiently large sample, every ERM hypothesis is probably approximately correct.

  • Programming

Why Capacity Matters

A learning algorithm must choose a hypothesis from a hypothesis class. If the class can represent many different labelings of the same points, it has considerable capacity. That flexibility can help the class represent a target rule, but it also means that the learner has many possible rules to consider. PAC learnability studies when a learner can still select a hypothesis that performs well beyond the training sample.

Tracing Every Labeling

Let C be a finite set of points from the input space. Each point in C can receive label 0 or label 1. If C contains two points, there are four possible labelings: both points labeled 0, the first labeled 0 and the second labeled 1, the first labeled 1 and the second labeled 0, and both points labeled 1. A hypothesis class shatters C when it contains hypotheses that realize every one of those possible labelings on C.

a00b011011label 0label 0label 0label 1label 1label 0label 1label 1
How can a hypothesis class realize every possible 0/1 labeling of the same chosen set of points?
Worked example

Checking Whether Two Points Are Shattered

Suppose a hypothesis class contains four hypotheses whose labelings on the chosen points a and b are 00, 01, 10, and 11. Is the set containing a and b shattered?

  1. 1
    List the possible labelings

    Two binary-labeled points have four possible labelings: 00, 01, 10, and 11.

  2. 2
    Compare the class with the list

    The hypothesis class realizes all four labelings on the same two points.

  3. 3
    Apply the definition

    Because every possible labeling is realized, the chosen two-point set is shattered.

Result

Yes. The hypothesis class shatters the chosen set containing a and b.

From Shattered Sets to VC-Dimension

Definition

The VC-dimension of a hypothesis class H, written VCdim(H), is the maximal size of a set that H shatters. It measures capacity through the largest collection of points on which the class can realize every binary labeling.

A particular shattered set and the VC-dimension are different objects. A shattered set is one specific set of points. The VC-dimension is a size: it records the largest size of any set that the class can shatter. If a class shatters one set of size three, that establishes only that its VC-dimension is at least three. A larger shattered set might still exist. If the class can shatter sets of arbitrarily large size, its VC-dimension is infinite.

Csize 3C shatteredVCdim(H)largest shattered-set sizeat least 3demonstratesimpliesrecords
What is the difference between one particular shattered set and the maximum size of any set the hypothesis class can shatter?
ObjectWhat it tells you
A particular shattered setThe class realizes every binary labeling on this chosen set.
VC-dimensionThe maximum size of any set that the class can shatter.
A shattered set of size threeThe VC-dimension is at least three, unless a larger maximum has already been established.
Infinite VC-dimensionThe class can shatter sets of arbitrarily large size.

Keep the specific set and the maximum size conceptually separate.

Capacity and Learnability

The connection to learning appears when an adversary may choose a distribution and a target labeling. If a hypothesis class contains every possible labeling of a chosen set, it has no useful restriction on the rules it may consider on that set. The No-Free-Lunch consequence is that, without restricting the hypothesis class, an adversary can construct a distribution on which a particular learning algorithm performs poorly, even though another algorithm succeeds on that same distribution.

PAC learnability places structure around this problem. The adversary is restricted to distributions for which some hypothesis in the class has zero risk. Under this realizability condition, the learner is not asked to approximate a target that the class cannot represent at all. The class's capacity still matters because it determines how many different rules are available to explain the observed sample.

The ERM Selection Process

Definition

Empirical risk minimization, or ERM, chooses a hypothesis with minimum empirical risk from the hypothesis class. For a finite hypothesis class, the learner evaluates the candidate hypotheses on the training sample and selects one whose observed error is as small as possible.

ERM uses the sample to compare candidates. It does not directly observe the true risk on the whole distribution. The finite-class PAC result explains when this sample-based selection is reliable: under realizability and with a sufficiently large sample, every ERM hypothesis is probably approximately correct.

Finite class HTraining sample SEvaluate candidatesCompare empiricalerrorsERM hypothesiscandidate hypothesesobserved examplesempirical errorsminimum
How does ERM evaluate candidate hypotheses on the training sample and select one with minimum empirical error?
Worked example

Selecting Among Three Candidates

A finite hypothesis class contains three candidate hypotheses. On the training sample, the candidates make respectively four, one, and two mistakes. Which candidate can ERM select?

  1. 1
    Evaluate each candidate

    The learner measures each candidate's empirical error on the same training sample.

  2. 2
    Compare the errors

    The observed error counts are four, one, and two.

  3. 3
    Apply ERM

    ERM selects a hypothesis with minimum empirical error, so the candidate with one mistake is selected.

Result

ERM selects the candidate with one observed mistake. If multiple candidates tie for the minimum, the rule can select any minimum-empirical-risk hypothesis.

Probably Approximately Correct

Definition

PAC means probably approximately correct. A learned hypothesis is approximately correct when its true error is within an allowed error tolerance. It is probably correct when that accuracy statement holds with high probability over the random choice of the training sample.

The guarantee is probabilistic because it concerns the random training sample. It does not claim that every possible sample produces an accurate hypothesis. Instead, for samples of the required size, it states that the desired accuracy holds with probability at least 1 minus delta. The error tolerance describes how much true error is allowed; delta describes the probability of failing to meet that accuracy.

Error toleranceallowed true errorPAC guaranteeaccurate beyond the sampleConfidenceat least 1 minus deltaapproximatelyprobably
How are the error tolerance and confidence probability represented in the statement that a learned hypothesis is probably approximately correct?

Sample Size and Guarantee Strength

The finite-class PAC result connects three parts of the learning situation: the sample size, the allowed error, and the confidence requirement. The source states that, under realizability, a sufficiently large sample makes the finite-class ERM rule probably approximately correct. The confidence statement is expressed as probability at least 1 minus delta over samples of the required size.

QuantityRole in the PAC result
Sample sizeMust be sufficiently large for the finite-class ERM guarantee to apply.
Allowed errorSpecifies how much true error the learned hypothesis may have while still meeting the accuracy requirement.
ConfidenceSpecifies how likely the accuracy statement is to hold over the random training sample; the source expresses this as at least 1 minus delta.
Finite hypothesis classProvides the candidate set from which ERM selects a minimum-empirical-risk hypothesis.

The result is a relationship among data, accuracy, confidence, and the candidate class.

Sample sizesufficiently largePAC ERM hypothesisaccurate beyond the sampleConfidence1 minus deltaAllowed erroraccuracy tolerancerequired conditionprobability statementaccuracy statement
How do sample size, confidence requirement, and allowed error participate in the PAC guarantee?

The Realizability Requirement

Definition

Realizability requires that at least one hypothesis in the hypothesis class has zero risk for the distribution and labeling function under consideration. In other words, the class contains a perfect hypothesis for that learning situation.

This assumption matters because the finite-class PAC result is stated only for distributions and labeling functions for which a zero-risk hypothesis exists in the class. Under that condition, ERM can search for a hypothesis that fits the sample while the theorem connects sufficient sample size to performance beyond the sample. If no perfect hypothesis exists in the class, the realizable finite-class result described here does not apply as stated.

Hypothesis class Hcontains zero-riskhypothesisERMfinite-class PAC resultappliesHypothesis class Hno zero-risk hypothesisERMstated result does notapplysupportsfalls outside
What changes when the hypothesis class contains a hypothesis with zero true error compared with when no perfect hypothesis exists?

Common Reasoning Mistakes

  • Common mistake

    Treating one shattered set as the VC-dimension

    What it looks like

    A class shatters a set of size three, so its VC-dimension is declared to be exactly three.

    Why it fails

    Shattering a set of size three proves only that the VC-dimension is at least three. A larger shattered set may exist.

    Do this instead

    Use the VC-dimension only after identifying the maximum size of any shattered set, or state the result as a lower bound.

  • Common mistake

    Checking only one labeling

    What it looks like

    The class realizes the labeling 01 on a chosen two-point set, so the set is called shattered.

    Why it fails

    Shattering requires every possible 0/1 labeling on the same chosen set.

    Do this instead

    List all possible binary labelings and verify that the class realizes each one.

  • Common mistake

    Reading PAC as a guarantee for every sample

    What it looks like

    The PAC result says that every training sample produces an accurate hypothesis.

    Why it fails

    The guarantee is probabilistic over the random choice of the training sample.

    Do this instead

    Interpret the statement as accuracy holding with probability at least 1 minus delta for samples of the required size.

  • Common mistake

    Ignoring realizability

    What it looks like

    The finite-class ERM result is applied even though no hypothesis in the class has zero risk.

    Why it fails

    The stated finite-class PAC result assumes that a zero-risk hypothesis exists in the class.

    Do this instead

    Check the realizability assumption before applying the result.

  • Common mistake

    Confusing empirical error with true error

    What it looks like

    The ERM hypothesis has minimum training error, so its true error is assumed to be minimum automatically.

    Why it fails

    ERM directly compares empirical errors on the observed sample. PAC analysis is what connects this selection to performance beyond the sample under the stated assumptions.

    Do this instead

    Keep the training-sample measurement and the distribution-wide guarantee conceptually separate.

Practice Check

MEDIUM

A hypothesis class realizes the labelings 000, 001, 010, 011, 100, 101, 110, and 111 on three chosen points. What can you conclude about shattering and VC-dimension? Then explain what additional information would be needed to claim that the VC-dimension equals three.

Hints
  • First compare the realized labelings with all possible binary labelings of three points.
  • Then separate the fact that one set is shattered from the question of whether a larger set can also be shattered.
EASY

A finite hypothesis class is used with ERM. State the two conditions needed for the finite-class PAC conclusion described in this article, and identify what the probability statement is taken over.

Hints
  • One condition concerns whether a perfect hypothesis exists in the class.
  • The other concerns how much data is available.
  • The probability concerns the random training sample.

Key Takeaways

  1. 1
    A hypothesis class shatters a chosen set when it realizes every possible 0/1 labeling of that set.
  2. 2
    The VC-dimension is the maximum size of any set the class can shatter; one shattered set gives a lower bound unless larger sets have been ruled out.
  3. 3
    PAC means probably approximately correct: the learned hypothesis has bounded true error with high probability over the random training sample.
  4. 4
    ERM selects a minimum-empirical-risk hypothesis from a finite hypothesis class.
  5. 5
    Under realizability and with a sufficiently large sample, the finite-class ERM rule is probably approximately correct.

At a glance

  • Shattering measures whether a class can realize every binary labeling on one chosen set.
  • VC-dimension records the largest size of a set that can be shattered, not the identity of one particular set.
  • ERM chooses a hypothesis with minimum empirical error from a finite class.
  • The finite-class PAC guarantee requires realizability and a sufficiently large sample.
  • Probably approximately correct combines an error tolerance with a high-probability statement over random training samples.

Related concepts

More concepts starting with P