Solution (source code)

= Solution

For a binary hypothesis class $\mathcal H=\{x\mapsto f(x,\alpha)\}$, a set of $m$ distinct points is shattered if every one of its $2^m$ binary labelings is realized by some member of $\mathcal H$. The <VC dimension> is
$$
\boxed{\operatorname{VC}(\mathcal H)=\sup\{m:\text{some }m\text{-point set is shattered by }\mathcal H\},}
$$
with value infinity if arbitrarily large finite sets are shattered. For real-valued scores, apply this definition to the associated binary decision functions, for example their signs. The word “some” matters: shattering every set of that size is not required.

As an example, take the interval classifiers on the real line, $f_{a,b}(x)=\mathbf1_{\{a\le x\le b\}}$. Two ordered points $x_1<x_2$ can receive labels $00$, $10$, $01$ or $11$ by choosing an interval away from both, around the first, around the second, or containing both. Hence the class shatters two points. No three ordered points can be shattered, since any interval containing the first and third also contains the middle, making labeling $101$ impossible. Thus the <VC dimension of interval indicators> is
$$
\boxed{\operatorname{VC}(\mathcal H)=2.}
$$
This describes combinatorial classification capacity, rather than merely counting written parameters; the definition applies equally to nonlinear or infinite-parameter classes.