← All notesLearning TheoryFoundation

Littlestone Dimension

Littlestone dimension, the optimal mistake bound, and the SOA proof, with a comparison to VC dimension.

6 min read PDF version

In deterministic, realizable online prediction, the optimal mistake bound is exactly the Littlestone dimension. This note defines and proves this characterization, then compares it with VC dimension: real thresholds, intervals, and affine halfspaces all have finite VC dimension but no finite mistake bound.

1. Online prediction and realizability

Let X≠∅\mathcal X\neq\varnothing be an input space and ∅≠H⊆{0,1}X\varnothing\neq\mathcal H\subseteq\{0,1\}^{\mathcal X} a class of binary-valued functions. Write N0:={0,1,2,…}\mathbb N_0:=\{0,1,2,\ldots\}.

A deterministic online learner is a sequence of maps A=(At)t≥1A=(A_t)_{t\geq1}, where

At:(X×{0,1})t−1×X⟶{0,1}.A_t:(\mathcal X\times\{0,1\})^{t-1}\times\mathcal X \longrightarrow\{0,1\}.

At round tt, the learner observes xtx_t, predicts y^t=At(z<t,xt)\widehat y_t=A_t(z_{<t},x_t), and then receives the label yty_t; here z<t:=((xs,ys))s<tz_{<t}:=((x_s,y_s))_{s<t} records the preceding inputs and labels.

Definition 1 (Realizability).

A sequence z1:T:=((xt,yt))t=1Tz_{1:T}:=((x_t,y_t))_{t=1}^T is H\mathcal H-realizable if there exists h⋆∈Hh^\star\in\mathcal H such that

yt=h⋆(xt),t=1,…,T.y_t=h^\star(x_t),\qquad t=1,\ldots,T.

Let ST(H)\mathcal S_T(\mathcal H) denote the set of these sequences.

Define the number of mistakes and its worst-case bound by

MT(A;z1:T):=∑t=1T1{y^t≠yt},MA(H):=sup⁡T≥1 sup⁡z1:T∈ST(H)MT(A;z1:T).\begin{aligned} M_T(A;z_{1:T}) &:=\sum_{t=1}^T\mathbf 1\{\widehat y_t\neq y_t\},\\ M_A(\mathcal H) &:=\sup_{T\geq1}\ \sup_{z_{1:T}\in\mathcal S_T(\mathcal H)} M_T(A;z_{1:T}). \end{aligned}

The optimal mistake bound is

M⋆(H):=inf⁡AMA(H),M^\star(\mathcal H):=\inf_A M_A(\mathcal H),

where the infimum ranges over all deterministic online learners, with no computational restrictions; both tt and TT range over the positive integers.

The question is when M⋆(H)<∞M^\star(\mathcal H)<\infty: can a constant independent of the horizon TT bound the number of mistakes on every H\mathcal H-realizable sequence? The trivial bound MT≤TM_T\leq T does not meet this requirement.

2. Trees and shattering

A complete binary tree of depth d∈N0d\in\mathbb N_0, with internal nodes taking values in X\mathcal X, can be represented as

x=(xt)t=1d,xt:{0,1}t−1⟶X.\mathbf x=(\mathbf x_t)_{t=1}^d,\qquad \mathbf x_t:\{0,1\}^{t-1}\longrightarrow\mathcal X.

Each internal node specifies an input, and each edge a label. The node reached by following the labels y<t:=(y1,…,yt−1)y_{<t}:=(y_1,\ldots,y_{t-1}) carries the input xt(y<t)\mathbf x_t(y_{<t}); y<1y_{<1} is the empty sequence.

Definition 2 (Littlestone dimension).

The class H\mathcal H shatters x\mathbf x if, for every y∈{0,1}dy\in\{0,1\}^d, the path

((xt(y<t),yt))t=1d\bigl((\mathbf x_t(y_{<t}),y_t)\bigr)_{t=1}^d

is H\mathcal H-realizable (Definition 1). Define

Ldim⁡(H):=sup⁡{d∈N0: H shatters some tree of depth d}.\operatorname{Ldim}(\mathcal H):= \sup\bigl\{d\in\mathbb N_0:\ \mathcal H\text{ shatters some tree of depth }d\bigr\}.

Every nonempty class shatters the depth-zero tree; we also set Ldim⁡(∅):=−1\operatorname{Ldim}(\varnothing):=-1.

3. The optimal mistake bound

The following theorem is due to Littlestone [1]; see [2, Theorem 10] for the formulation for arbitrary function classes.

Theorem 1 (Littlestone, 1988).

For every nonempty class H\mathcal H of binary-valued functions,

M⋆(H)=Ldim⁡(H).M^\star(\mathcal H)=\operatorname{Ldim}(\mathcal H).

Lower bound

Fix a deterministic learner AA and a tree of depth d≥1d\geq1 shattered by H\mathcal H. For t=1,…,dt=1,\ldots,d, set

xt:=xt(y<t),y^t:=At(z<t,xt),yt:=1−y^t.x_t:=\mathbf x_t(y_{<t}),\qquad \widehat y_t:=A_t(z_{<t},x_t),\qquad y_t:=1-\widehat y_t.

By Definition 2,

∃h∈H,∀t≤d,h(xt)=h(xt(y<t))=yt.\exists h\in\mathcal H,\quad\forall t\leq d,\qquad h(x_t)=h\bigl(\mathbf x_t(y_{<t})\bigr)=y_t.

Thus z1:d∈Sd(H)z_{1:d}\in\mathcal S_d(\mathcal H) and MA(H)≥Md(A;z1:d)=dM_A(\mathcal H)\geq M_d(A;z_{1:d})=d. Taking the infimum over AA and then the supremum over the depths of trees shattered by H\mathcal H gives M⋆(H)≥Ldim⁡(H)M^\star(\mathcal H)\geq\operatorname{Ldim}(\mathcal H). When Ldim⁡(H)=0\operatorname{Ldim}(\mathcal H)=0, the bound follows from nonnegativity.

Upper bound: SOA

Fix any H\mathcal H-realizable sequence and suppose D:=Ldim⁡(H)<∞D:=\operatorname{Ldim}(\mathcal H)<\infty. At round tt, retain the functions consistent with the observed labels to form the version space VtV_t. Partition it into two subclasses according to their values at xtx_t:

Vt:={h∈H: h(xs)=ys for all s<t},Vt(b):={h∈Vt: h(xt)=b},b∈{0,1}.\begin{aligned} V_t&:=\{h\in\mathcal H:\ h(x_s)=y_s\text{ for all }s<t\},\\ V_t^{(b)}&:=\{h\in V_t:\ h(x_t)=b\},\quad b\in\{0,1\}. \end{aligned}

After observing yty_t, set Vt+1=Vt(yt)V_{t+1}=V_t^{(y_t)}.

Let k:=Ldim⁡(Vt)k:=\operatorname{Ldim}(V_t). Both subclasses have dimension at most kk, and

min⁡b∈{0,1}Ldim⁡(Vt(b))≤k−1.\min_{b\in\{0,1\}}\operatorname{Ldim}(V_t^{(b)})\leq k-1.

Otherwise, each subclass would shatter a tree of depth kk. Attaching these two trees below a root xtx_t would yield a tree of depth k+1k+1 shattered by VtV_t, contradicting the definition of kk.

The Standard Optimal Algorithm (SOA) predicts

y^t∈arg max⁡b∈{0,1}Ldim⁡(Vt(b)),\widehat y_t\in \underset{b\in\{0,1\}}{\operatorname{arg\,max}} \operatorname{Ldim}(V_t^{(b)}),

with ties always broken in favor of 00.

Remark (Computability).

The dimensions of the two subclasses are well-defined, so fixing the tie-breaking rule makes SOA a prediction map. Defining this map does not compute it: no method for computing these two dimensions is given here, nor is a computable implementation of SOA guaranteed [2].

If the prediction is wrong, the retained branch is the other one, whose dimension is the smaller of the two:

Ldim⁡(Vt+1)=min⁡b∈{0,1}Ldim⁡(Vt(b))≤Ldim⁡(Vt)−1.\operatorname{Ldim}(V_{t+1}) =\min_{b\in\{0,1\}}\operatorname{Ldim}(V_t^{(b)}) \leq\operatorname{Ldim}(V_t)-1.

If the prediction is correct, Vt+1⊆VtV_{t+1}\subseteq V_t ensures that the dimension does not increase. Each mistake lowers the dimension by at least one, while realizability ensures VT+1≠∅V_{T+1}\neq\varnothing, so its dimension cannot fall below zero. Since V1=HV_1=\mathcal H, the total number of mistakes satisfies

MT(SOA;z1:T)≤D−Ldim⁡(VT+1)≤D.M_T(\mathrm{SOA};z_{1:T}) \leq D-\operatorname{Ldim}(V_{T+1})\leq D.

Thus M⋆(H)≤DM^\star(\mathcal H)\leq D, which, together with the lower bound, proves the result. When Ldim⁡(H)=∞\operatorname{Ldim}(\mathcal H)=\infty, the lower bound alone proves the result.□\square

4. Comparison with VC dimension

Definition 3 (VC dimension).

The class H\mathcal H shatters a finite set F⊆XF\subseteq\mathcal X if

∀ ℓ:F→{0,1},∃ h∈H,∀ x∈F,h(x)=ℓ(x).\forall\,\ell:F\to\{0,1\},\quad \exists\,h\in\mathcal H,\quad \forall\,x\in F,\qquad h(x)=\ell(x).

The VC dimension (Vapnik–Chervonenkis dimension) is

VCdim⁡(H):=sup⁡{∣F∣: F⊆X finite, H shatters F}.\operatorname{VCdim}(\mathcal H):= \sup\bigl\{|F|:\ F\subseteq\mathcal X \text{ finite},\ \mathcal H\text{ shatters }F\bigr\}.

Every nonempty class shatters the empty set. Both VCdim⁡(H)\operatorname{VCdim}(\mathcal H) and Ldim⁡(H)\operatorname{Ldim}(\mathcal H) take values in N0∪{∞}\mathbb N_0\cup\{\infty\}.

Proposition 1 (Comparison of dimensions).

VCdim⁡(H)≤Ldim⁡(H),Ldim⁡(H)≤⌊log⁡2∣H∣⌋(H finite).\operatorname{VCdim}(\mathcal H)\leq\operatorname{Ldim}(\mathcal H),\qquad \operatorname{Ldim}(\mathcal H)\leq\lfloor\log_2|\mathcal H|\rfloor \quad(\mathcal H\text{ finite}).

Proof.

If H\mathcal H shatters {u1,…,ud}\{u_1,\ldots,u_d\}, it also shatters the tree xt(y<t)=ut\mathbf x_t(y_{<t})=u_t, giving the first inequality.

A function realizes at most one path in a fixed tree. Shattering a tree of depth dd therefore requires at least 2d2^d functions, giving the second inequality. □\square

In VC shattering, the inputs are fixed in advance; in a tree, they may depend on the preceding labels.

Real threshold functions

Let hθ(x):=1{x≤θ}h_\theta(x):=\mathbf 1\{x\leq\theta\}, with x,θ∈Rx,\theta\in\mathbb R. This class shatters a single point but cannot assign labels (0,1)(0,1) to two increasing inputs, so its VC dimension is 11. To determine its Ldim, it suffices to restrict the parameter to (0,1)(0,1). Given a feasible parameter interval (a,b)(a,b), query its midpoint x=(a+b)/2x=(a+b)/2 and retain

y=0 ⟹ retain (a,x),y=1 ⟹ retain (x,b).y=0\ \Longrightarrow\ \text{retain }(a,x),\qquad y=1\ \Longrightarrow\ \text{retain }(x,b).

Either label leaves a nonempty open interval. For every finite depth, this constructs a tree shattered by the class. Hence [3, §21.1.1]

VCdim⁡({hθ:θ∈R})=1,Ldim⁡({hθ:θ∈R})=∞.\operatorname{VCdim}(\{h_\theta:\theta\in\mathbb R\})=1,\qquad \operatorname{Ldim}(\{h_\theta:\theta\in\mathbb R\})=\infty.

5. Two familiar examples

Intervals and affine halfspaces also have finite VC dimension and infinite Ldim. Both reproduce the threshold construction above.

Intervals. On the input space R\mathbb R, define

Hint:={x↦1{a≤x≤b}:a,b∈R, a≤b}.\mathcal H_{\mathrm{int}} :=\{x\mapsto\mathbf 1\{a\leq x\leq b\}:a,b\in\mathbb R,\ a\leq b\}.

This class shatters any two distinct points but cannot realize the labels (1,0,1)(1,0,1) on three increasing points. This determines its VC dimension; the Ldim claim is proved below:

VCdim⁡(Hint)=2,Ldim⁡(Hint)=∞.\operatorname{VCdim}(\mathcal H_{\mathrm{int}})=2,\qquad \operatorname{Ldim}(\mathcal H_{\mathrm{int}})=\infty.

Affine halfspaces. For an integer p≥1p\geq1, take the input space Rp\mathbb R^p and define

Hhs(p):={x↦1{w⊤x+b≥0}:w∈Rp, b∈R}.\mathcal H_{\mathrm{hs}}^{(p)} :=\{x\mapsto\mathbf 1\{w^\top x+b\geq0\}:w\in\mathbb R^p,\ b\in\mathbb R\}.

The classical VC dimension result [3, §9.1.3] and the construction below give

VCdim⁡(Hhs(p))=p+1,Ldim⁡(Hhs(p))=∞.\operatorname{VCdim}(\mathcal H_{\mathrm{hs}}^{(p)})=p+1,\qquad \operatorname{Ldim}(\mathcal H_{\mathrm{hs}}^{(p)})=\infty.

No margin condition is imposed here; a finite parameter dimension does not guarantee a finite mistake bound.

Proof of the Ldim claims. Let t,θ∈(0,1)t,\theta\in(0,1).

For the interval [0,θ][0,\theta], the label of input tt is 1{t≤θ}\mathbf 1\{t\leq\theta\}.

For the halfspace x1≤θx_1\leq\theta, query only points (t,0,…,0)(t,0,\ldots,0) on the first coordinate axis. The label is again 1{t≤θ}\mathbf 1\{t\leq\theta\}.

In both cases, the threshold bisection tree from the preceding section applies directly, so both classes have infinite Ldim.

References

  1. N. Littlestone (1988). Learning quickly when irrelevant attributes abound: A new linear-threshold algorithm. Machine Learning, 2:285–318.

  2. N. Hasrati and S. Ben-David (2023). On Computable Online Learning. ALT, PMLR 201:707–725.

  3. S. Shalev-Shwartz and S. Ben-David (2014). Understanding Machine Learning: From Theory to Algorithms. Cambridge University Press.