Concepts / VC Dimension

VC Dimension

An ϵ-net turns a sample into a coverage guarantee for all sufficiently probable sets in a hypothesis class.

  • Programming

From Samples to Guarantees

A learner sees only a finite labeled sample, but a PAC guarantee concerns performance on the entire underlying distribution. The central question is therefore whether the sample is capable of detecting every hypothesis that disagrees with the target on a sufficiently large part of that distribution. VC dimension supplies the capacity measure, while epsilon-nets supply the coverage argument that turns a sample into a guarantee.

VC dimension measures how many points a hypothesis class can shatter: the largest number for which every possible binary labeling can be produced by some classifier in the class.

Epsilon-Net Coverage

An epsilon-net for a class of sets under a distribution is a sample that intersects every set in the class whose probability is at least epsilon. Each set represents a region of the domain, and only sufficiently probable regions are required to be hit. Regions with probability below epsilon are not required to intersect the sample.

The important feature is the universal coverage requirement. The sample is not merely likely to hit one particular high-probability set. It must hit every set in the relevant class that has probability at least epsilon. This is what allows the argument to eliminate an entire collection of bad hypotheses at once.

defines probabilityepsilon-net hitsreveals disagreementDistribution Ddomain regionsSet with probabilityat least epsilonsubstantial regionSample Sintersects the setLarge-errorhypothesis detectedsample disagreement
How does a finite sample become a coverage guarantee that rules out every hypothesis whose true error is at least epsilon?

Disagreement Class H_c

To apply epsilon-net coverage to classification, fix a target hypothesis c and compare every candidate h with c. For each h in H, form the set of domain points on which h and c disagree. The collection of all such disagreement sets is the class H_c.

Turning Error into Set Intersection

Relate the true error of a hypothesis h to its disagreement set with the target c.

Construct the set: Take every point on which h and c produce different labels. Those points form the disagreement set associated with h.

Measure the set: Under the distribution D, the probability of this disagreement set equals the true error of h.

Apply epsilon coverage: If h has true error at least epsilon, its disagreement set has probability at least epsilon, so an epsilon-net must contain a sampled point from that set.

Interpret the sampled point: At that sampled point, h disagrees with c and therefore makes an error on a sample labeled according to c.

The classification question has become a set-intersection question: every hypothesis with true error at least epsilon corresponds to a sufficiently probable disagreement set that the sample must hit.

compare each hcompare with ccollect setsVCdim(H)VCdim(H_c)Hcandidate hypothesesh disagrees with cone disagreement setH_call disagreement setsVC dimensionsame as Hctarget hypothesis
How is H_c constructed from the original hypothesis class, and why does the construction preserve the class's ability to shatter points?

The PAC Proof Trace

Assume the realizable setting: the target c belongs to H, and the sample receives labels according to c. Consider a candidate h whose true error is at least epsilon. Its disagreement set with c therefore has probability at least epsilon. If the sample is an epsilon-net for H_c, the sample intersects that disagreement set, so h makes at least one error on the labeled sample.

preserved by H_ccontrols required mprovides coverageexcludes large-error hrealizable PAC resultVC dimension of Hcapacity measureVC dimension of H_csame complexitySample size mTheorem 28.3Epsilon-net coverageall large disagreement setsERM hypothesisconsistent with sampleTrue error at mostepsilonprobability at least 1minus delta
How does VC dimension control the relevant set class and lead from sample coverage to a PAC guarantee?

Because c is consistent with the sample, a hypothesis that makes a sampled error cannot be an empirical-risk minimizer. Therefore, once the sample intersects every disagreement set of probability at least epsilon, every hypothesis with true error at least epsilon is excluded from being an ERM hypothesis.

The realizable PAC guarantee stated in Theorem 28.4 is that, with probability at least 1 minus delta over the choice of m independent and identically distributed instances labeled according to c, any ERM hypothesis has true error at most epsilon. The sample size m is the one specified by Theorem 28.3.

Capacity Through Shattering

A classification class is more expressive when it can realize more different labelings of data points. VC dimension measures this capacity by asking for the largest number of points that can be shattered. A set of points is shattered when every possible binary labeling of those points can be produced by some classifier in the class.

In the PAC argument, VC dimension controls the complexity of the relevant hypothesis or disagreement class. The equality between the VC dimensions of H and H_c allows the complexity of H to be carried into the epsilon-net analysis. Thus, VC dimension connects the number of distinguishable labelings to the sample size needed for a high-probability learning guarantee.

Homogeneous Halfspaces

For homogeneous halfspaces in R^d, the separating boundary is required to pass through the origin. Their VC dimension is exactly d.

The Lower Bound for Homogeneous Halfspaces

Show why homogeneous halfspaces can shatter d points in R^d.

Choose points: Use the d standard basis vectors e1 through ed. Each basis vector has a 1 in one coordinate and 0 in all other coordinates.

Choose the weight vector: For a desired binary labeling, use the desired labels as the coordinates of the weight vector w.

Evaluate the dot products: The dot product of w with the basis vector ei selects the i-th coordinate of w, so it equals the desired label associated with ei.

Conclude shattering: Because every binary labeling can be obtained by choosing the coordinates of w appropriately, the d basis vectors are shattered.

Homogeneous halfspaces can shatter at least d points.

For the upper bound, take any d+1 vectors in R^d. They are linearly dependent, so there are real coefficients, not all zero, whose weighted combination is the zero vector. Separate the indices with positive coefficients from those with negative coefficients. If both groups are nonempty, a weight vector that assigns the required opposite signs would create incompatible sign conditions when applied to the dependence relation. If one group is empty, the corresponding side becomes an equality and the contradiction still follows. Therefore, no d+1 vectors can be shattered by homogeneous halfspaces.

The lower bound comes from explicitly shattering d basis vectors. The upper bound comes from the linear dependence that every collection of d+1 vectors in R^d must satisfy. Together, these establish VC dimension d.

Bias Adds One Degree

Non-homogeneous halfspaces in R^d include a bias term, so their separating boundary is not required to pass through the origin. Their VC dimension is exactly d+1.

shattersupper and lower boundsshatterslower and upper boundsHomogeneoushalfspaceweight vector wd shattered pointsstandard basis vectorsVC dimension dboundary through originNon-homogeneoushalfspaceweight vector w and biasd+1 shattered pointszero vector and basisvectorsVC dimension d+1bias shifts boundary
What changes in the shattering argument when a halfspace gains a bias term, and why does the VC dimension increase from d to d+1?

For the lower bound, use the zero vector together with the d standard basis vectors. The source proof states that this set of d+1 vectors is shattered by non-homogeneous halfspaces, paralleling the homogeneous construction for the basis vectors.

For the upper bound, suppose d+2 vectors in R^d could be shattered by non-homogeneous halfspaces. The standard reduction described in the source converts this into d+2 vectors in R^(d+1) shattered by homogeneous halfspaces. That contradicts the homogeneous result, because homogeneous halfspaces in R^(d+1) have VC dimension d+1 and cannot shatter d+2 vectors. Hence the non-homogeneous VC dimension is d+1.

determines separationworks with biasadds freedomWeight vector wd coordinatesOrigin-constrainedboundaryVC dimension dBias termadditional parameterShifted boundaryVC dimension d+1
How do the d coordinates of the weight vector and the additional bias parameter affect the set of labelings that can be realized?

Common Reasoning Errors

  • Treating an epsilon-net as a guarantee about only one selected set.

    An epsilon-net must intersect every set in the relevant class whose probability is at least epsilon.

    Fix: Keep the universal requirement in view: the same sample must cover all sufficiently probable sets in the class.

  • Using the original hypotheses directly without constructing the disagreement class.

    The epsilon-net argument operates on sets, while classification error is a property of hypotheses.

    Fix: Associate each h with its disagreement set with c, then use the equality between true error and the distribution probability of that set.

  • Assuming that a large true error automatically prevents ERM selection.

    ERM minimizes empirical risk, so the proof must show that a large-error hypothesis makes at least one sampled error.

    Fix: Use epsilon-net coverage to force the sample to intersect the hypothesis's disagreement set.

  • Forgetting the realizability condition.

    The argument relies on c being consistent with the sample, which makes a sampled-error hypothesis unable to minimize empirical risk.

    Fix: State that the guarantee is for the realizable setting and for samples labeled according to c.

  • Giving both kinds of halfspaces the same VC dimension.

    Homogeneous halfspaces in R^d have VC dimension d, while non-homogeneous halfspaces have VC dimension d+1.

    Fix: Track whether the boundary must pass through the origin and whether a bias parameter is available.

Check Your Understanding

MEDIUM

Explain the complete elimination argument in your own words. Start with a hypothesis h whose true error is at least epsilon. Identify its disagreement set with c, explain why the set has probability at least epsilon, state what the epsilon-net guarantees, and finish by explaining why h cannot be an ERM hypothesis in the realizable setting.

Hints
  • Translate true error into the probability of a disagreement set.
  • Use the coverage property of an epsilon-net for H_c.
  • Remember that c is consistent with the labeled sample.
HARD

Compare the two halfspace classes. Explain why the standard basis vectors establish the lower bound d for homogeneous halfspaces, why linear dependence establishes the upper bound, and how the zero vector and bias term lead to d+1 for non-homogeneous halfspaces.

Hints
  • For homogeneous halfspaces, use the d standard basis vectors.
  • For the upper bound, consider d+1 vectors in R^d.
  • For non-homogeneous halfspaces, include the zero vector and use the reduction to one higher dimension.

Key Takeaways

  1. An epsilon-net intersects every set in the relevant class whose probability is at least epsilon.
  2. The disagreement class H_c converts the true classification error of h into the probability of a set.
  3. If the sample is an epsilon-net for H_c, every hypothesis with true error at least epsilon makes a sampled error and cannot be an ERM hypothesis in the realizable setting.
  4. VC dimension measures the largest number of points that a class can shatter and carries from H to H_c in the source argument.
  5. Homogeneous halfspaces in R^d have VC dimension d, while non-homogeneous halfspaces have VC dimension d+1 because the bias term adds one parameter of freedom.

Key Takeaways

  • An epsilon-net turns finite sampling into coverage of every sufficiently probable set.
  • The disagreement class H_c links hypothesis error to set probability and preserves VC dimension according to the source argument.
  • In the realizable PAC setting, epsilon-net coverage excludes all hypotheses with true error at least epsilon from being ERM hypotheses.
  • VC dimension is the largest number of points a class can shatter.
  • Homogeneous halfspaces in R^d have VC dimension d, whereas non-homogeneous halfspaces have VC dimension d+1.