Concepts / Shattering

Shattering

Intervals over the real numbers form a class of binary-valued functions.

  • Programming

A Labeling Challenge

Imagine placing a finite collection of points on the real number line. An interval chooses some of those points and leaves the others unchosen. We can record this choice with binary labels: a point inside the interval receives 1, and a point outside the interval receives 0. The central question is how many different labelings an interval class can produce on the same fixed set of points.

What do you think happens?

Can one class of intervals produce every possible binary labeling of two ordered points?

  • Yes
  • No
Reveal answer

Answer: Yes

Intervals can select neither point, either one of the two points, or both points. Therefore they realize all four labelings of a two-point set.

Intervals as Binary Functions

The class of intervals over the real numbers is a class of binary-valued functions. An interval is determined by endpoints a and b with a less than b. For a chosen interval, each real number receives the value 1 if it lies inside the interval and the value 0 if it lies outside it.

The interval therefore acts as a rule for labeling points. It does not assign arbitrary labels independently to each point. Instead, the labels are controlled by membership in one connected region of the real line: points selected by the interval receive 1, while points not selected receive 0.

containsdoes not containSelected intervalmembership rulePoint inside1Point outside0
Which real numbers receive value 1 or 0 from a selected interval?

Meaning of Shattering

A function class shatters a finite set when it achieves every possible labeling of that set. For a set of n points, every assignment of binary values to those points must be produced by some function in the class.

For two points, the possible labelings are 0, 0; 0, 1; 1, 0; and 1, 1. To prove that intervals shatter the two-point set, we must show that each of these four patterns can be produced by choosing a suitable interval. It is not enough to produce several patterns; shattering requires every possible pattern.

choose an intervalchoose an intervalchoose an intervalchoose an intervalFixed set Ctwo points00neither selected01second selected10first selected11both selected
What does it mean for an interval class to realize every binary labeling of one fixed set?

Two Points Can Be Shattered

The set containing 1 and 2

Show that intervals realize every labeling of the set C = {1, 2}.

Labeling 0, 0: Choose an interval that contains neither 1 nor 2.

Labeling 1, 0: Choose an interval around 1 that does not contain 2.

Labeling 0, 1: Choose an interval around 2 that does not contain 1.

Labeling 1, 1: Choose an interval wide enough to contain both 1 and 2.

All four labelings are realized, so the interval class shatters C = {1, 2}.

Label of 1Label of 2What the interval must do
00Exclude both points
10Include 1 and exclude 2
01Exclude 1 and include 2
11Include both points

The four possible binary labelings of the two-point set {1, 2}.

producesproducesproducesproduces00neither point insideInterval Arealizes 0010first point insideInterval Brealizes 1001second point insideInterval Crealizes 0111both points insideInterval Drealizes 11
How can intervals on the real line realize all four possible positive and negative labelings of two ordered points?

The Three-Point Obstacle

Now consider any three points and arrange them from left to right as c1, c2, and c3, with c1 less than or equal to c2 and c2 less than or equal to c3. One possible labeling is 1, 0, 1: the two outer points should be inside the interval, while the middle point should be outside.

This labeling cannot be produced by an interval. If an interval reaches c1 and c3, then it must also include the point c2 lying between them. The interval cannot include both outer points while leaving the middle point outside.

interval reaches c1middle point is betweeninterval reaches c3c11c11c20c21c31c31
Why can no single interval label the two outer points positive while labeling the middle point negative?

From Shattering to VC-Dimension

The VC-dimension of a function class is the size of the largest set shattered by that class. It measures how many different labelings the class can produce on a finite set at its largest completely flexible size.

For intervals, the lower bound comes from the two-point set {1, 2}, which is shattered. Therefore the VC-dimension is at least 2. The upper bound comes from the three-point argument: no set of three points can be shattered because the labeling 1, 0, 1 is impossible. Therefore the VC-dimension cannot be 3 or larger.

at least 2less than 3Two pointsshatteredVC-dimension 2largest shattered sizeThree pointsnot shattered
How does a shattered set of two points and an unshatterable set of three points determine the VC-dimension?

The two matching bounds give VCdim(H) = 2 for the class H of intervals over the real numbers.

Common Reasoning Mistakes

  • Showing only some labelings of two points

    Shattering requires every possible labeling, including 1, 0 and 0, 1.

    Fix: List all four labelings of two points and account for each one.

  • Treating the labels of three points as independent choices

    The labels must come from one interval, and an interval that contains both outer points must contain the point between them.

    Fix: Use the order of the points on the real line when checking whether a labeling is possible.

  • Proving only that one particular three-point set is not shattered

    To establish the upper bound, the argument must apply to any three-point set.

    Fix: Write the points generally as c1, c2, and c3 in sorted order, then apply the middle-point argument.

  • Confusing a lower bound with the final VC-dimension

    A shattered two-point set proves only that the VC-dimension is at least 2.

    Fix: Also show that no three-point set is shattered, giving the matching upper bound.

Check Your Understanding

EASY

Let C be a set of three ordered real points c1, c2, and c3. Explain why the labeling 1, 0, 1 cannot be produced by any interval. Then state what this implies about shattering three-point sets.

Hints
  • Identify which points the interval must contain.
  • Use the fact that c2 lies between c1 and c3.
  • Connect the failed labeling to the definition of shattering.
MEDIUM

For the set C = {1, 2}, describe what an interval must do to produce each of the four labelings: 0, 0; 0, 1; 1, 0; and 1, 1. Use your list to justify that intervals shatter C.

Hints
  • Interpret 1 as inside the interval.
  • Interpret 0 as outside the interval.
  • There are four possible binary labelings of two points.

Final Takeaways

  1. Intervals over the real numbers form a class of binary-valued functions: points inside an interval receive 1, and points outside receive 0.
  2. A class shatters a finite set when it realizes every possible binary labeling of that set.
  3. Intervals shatter the two-point set {1, 2} because they can realize all four labelings.
  4. No interval can realize the labeling 1, 0, 1 on three ordered points because the middle point lies between the two outer points.
  5. The largest shattered set has size 2, so the VC-dimension of intervals over the real numbers is 2.

Key Takeaways

  • Shattering means realizing every possible labeling of a fixed finite set.
  • An interval labels points according to membership: inside means 1 and outside means 0.
  • Intervals shatter two points but cannot shatter three points.
  • The impossible three-point labeling is 1, 0, 1.
  • The VC-dimension of the class of intervals over the real numbers is 2.