Documentation

CslibFrontier.MachineLearning.PACLearning.OneInclusionGraph

The One-Inclusion Graph Predictor and Transductive Error Bound #

For a binary concept class C : ConceptClass α Bool of VC dimension d, empirical risk minimization requires Ω((d log (1 / ε)) / ε) examples in the worst case. Haussler, Littlestone, and Warmuth [HLW94] removed the log (1 / ε) factor in expectation using the one-inclusion graph (the induced subgraph of the Boolean hypercube on the labelings C realizes on the m + 1 observed and test points):

  1. Subgraph density bound (card_oneInclusionEdges_le_mul_card, Lemma 2.4 (locator unverified)): if every finite shattered set of S : Finset (ι → Bool) has size at most d, then the one-inclusion graph of S has at most d * |S| edges.
  2. Bounded-outdegree orientation (exists_orientation_outdegree_le, §2.3 (locator unverified) / Hakimi's theorem via Hall's marriage theorem): every induced subgraph U ⊆ S has at most d * |U| edges, so the edges of S can be oriented so that every vertex has outdegree at most d.
  3. Leave-one-out transductive bound (card_leaveOneOut_mistakes_le, Theorem 2.3 (locator unverified)): the parameter-free improper predictor oneInclusionLearner C orients the one-inclusion graph on the unordered point set of m labeled training examples plus one unlabeled test point, predicting toward edge heads (and reusing the observed label on duplicate points). On any realizable sample of length m + 1, oneInclusionLearner C errs on at most d of the m + 1 leave-one-out folds.
  4. Expected generalization error and O(d / (ε δ)) PAC learning (lintegral_error_oneInclusionLearner_le, isPACLearnerFor_oneInclusionLearner, sampleComplexity_realizableDistributions_le_div_vcDim): by exchangeability of D ^ (m + 1), oneInclusionLearner C achieves expected true error at most d / (m + 1) (with exact constant 1 and no logarithmic factors), yielding an (ε, δ)-PAC learner whenever d ≤ ε δ (m + 1). At fixed confidence δ, this achieves the optimal O(d / ε) dependence in ε matching Ehrenfeucht–Haussler–Kearns–Valiant [EHKV89].

Main definitions #

Main results #

References #

1. The one-inclusion graph and the d * |S| edge-density bound #

Canonical undirected edges (i, f) of the one-inclusion graph of S : Finset (ι → Bool): coordinate i : ι paired with the lower endpoint f ∈ S (f i = false) whose i-flip Function.update f i true also belongs to S [HLW94].

@[simp]
theorem Cslib.MachineLearning.PACLearning.mem_oneInclusionEdges {ι : Type u_2} [DecidableEq ι] [Fintype ι] {S : Finset (ι → Bool)} {e : ι × (ι → Bool)} :
theorem Cslib.MachineLearning.PACLearning.oneInclusionEdges_mono {ι : Type u_2} [DecidableEq ι] [Fintype ι] {S₁ S₂ : Finset (ι → Bool)} (h : S₁ ⊆ S₂) :
theorem Cslib.MachineLearning.PACLearning.card_oneInclusionEdges_le_mul_card {ι : Type u_2} [DecidableEq ι] [Fintype ι] {d : ℕ} {S : Finset (ι → Bool)} (hS : ∀ (W : Finset ι), SetShatters ↑S ↑W → W.card ≤ d) :

Haussler–Littlestone–Warmuth subgraph edge-density bound [HausslerLittlestoneWarmuth1994, Lemma 2.4 (locator unverified)]: if S : Finset (ι → Bool) shatters no finite set of more than d coordinates, then (oneInclusionEdges S).card ≤ d * S.card. Apply the weighted hypercube edge bound to the indicator of S.

2. Bounded-outdegree orientation via Hall's marriage theorem #

def Cslib.MachineLearning.PACLearning.tailEndpoint {ι : Type u_2} [DecidableEq ι] (orient : ι × (ι → Bool) → Bool) (e : ι × (ι → Bool)) :
ι → Bool

The tail endpoint of edge e = (i, f) under orientation orient: when orient e = true the edge points from f (e.2 e.1 = false) to Function.update f i true, so the tail is f; when orient e = false the tail is Function.update f i true.

def Cslib.MachineLearning.PACLearning.oneInclusionOutdegree {ι : Type u_2} [DecidableEq ι] [Fintype ι] (S : Finset (ι → Bool)) (orient : ι × (ι → Bool) → Bool) (g : ι → Bool) :

Outdegree of g in oneInclusionEdges S under edge orientation orient.

theorem Cslib.MachineLearning.PACLearning.exists_orientation_outdegree_le {ι : Type u_2} [DecidableEq ι] [Fintype ι] {d : ℕ} {S : Finset (ι → Bool)} (hS : ∀ (W : Finset ι), SetShatters ↑S ↑W → W.card ≤ d) :
∃ (orient : ι × (ι → Bool) → Bool), ∀ (g : ι → Bool), oneInclusionOutdegree S orient g ≤ d

Haussler–Littlestone–Warmuth Bounded-Outdegree Orientation Lemma [HausslerLittlestoneWarmuth1994, §2.3 (locator unverified)]: if S : Finset (ι → Bool) shatters no finite set of more than d coordinates, then oneInclusionEdges S admits an orientation orient in which every vertex has outdegree at most d.

3. Parameter-free one-inclusion learner and transductive leave-one-out bound #

noncomputable def Cslib.MachineLearning.PACLearning.oneInclusionLearner {α : Type u_1} (C : ConceptClass α Bool) {m : ℕ} (S : LabeledSample α Bool m) (x : α) :

The parameter-free Haussler–Littlestone–Warmuth one-inclusion graph learner [HausslerLittlestoneWarmuth1994, §2 (locator unverified)]: if test point x already appears in S, reuse its observed label; otherwise form the unordered point set U of S and x, restrict to concepts of C consistent with S, and resolve 0/1 ambiguity at x using canonicalOrient C U.

On any realizable sample S, oneInclusionLearner C S reproduces the observed label on every training example (S j).1.

theorem Cslib.MachineLearning.PACLearning.oneInclusionLearner_eq_of_forall_consistent {α : Type u_1} {C : ConceptClass α Bool} {m : ℕ} {S : LabeledSample α Bool m} (hS : Realizable C S) {x : α} {b : Bool} (huniq : ∀ c ∈ C, (∀ (j : Fin m), (S j).2 = c (S j).1) → c x = b) :

If S is realizable by C and every concept in C consistent with S assigns label b to x, then oneInclusionLearner C S x = b.

theorem Cslib.MachineLearning.PACLearning.card_leaveOneOut_mistakes_le {α : Type u_1} {C : ConceptClass α Bool} {d m : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) {Z : LabeledSample α Bool (m + 1)} (hZ : Realizable C Z) :
{t : Fin (m + 1) | oneInclusionLearner C (t.removeNth Z) (Z t).1 ≠ (Z t).2}.card ≤ d

Haussler–Littlestone–Warmuth Transductive Leave-One-Out Bound [HausslerLittlestoneWarmuth1994, Theorem 2.3 (locator unverified)]: if C shatters no finite set of more than d points, then on every realizable (m + 1)-sample Z (Realizable C Z), oneInclusionLearner C errs on at most d of the m + 1 leave-one-out folds (t.removeNth Z, (Z t).1).

4. Expected generalization error d / (m + 1) and realizable PAC sample complexity #

theorem Cslib.MachineLearning.PACLearning.lintegral_error_eq_leaveOneOut {α : Type u_1} [MeasurableSpace α] {m : ℕ} {A : Learner α Bool m} (hA : Measurable fun (p : LabeledSample α Bool m × α) => A p.1 p.2) (D : MeasureTheory.Measure (α × Bool)) [MeasureTheory.IsProbabilityMeasure D] (t : Fin (m + 1)) :
(∫⁻ (S : Fin m → α × Bool), error D (A S) ∂MeasureTheory.Measure.pi fun (x : Fin m) => D) = (MeasureTheory.Measure.pi fun (x : Fin (m + 1)) => D) {Z : Fin (m + 1) → α × Bool | A (t.removeNth Z) (Z t).1 ≠ (Z t).2}

Exchangeability of D ^ (m + 1): for any jointly measurable learner A : Learner α Bool m and any coordinate t : Fin (m + 1), the expected true error of A on m i.i.d. examples equals the probability that A errs on held-out example t of m + 1 i.i.d. examples.

theorem Cslib.MachineLearning.PACLearning.lintegral_error_oneInclusionLearner_le {α : Type u_1} [MeasurableSpace α] {C : ConceptClass α Bool} {d m : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) (hmeas : Measurable fun (p : LabeledSample α Bool m × α) => oneInclusionLearner C p.1 p.2) {D : MeasureTheory.Measure (α × Bool)} [MeasureTheory.IsProbabilityMeasure D] (hD : IsRealizableBy D C) :
(∫⁻ (S : Fin m → α × Bool), error D (oneInclusionLearner C S) ∂MeasureTheory.Measure.pi fun (x : Fin m) => D) ≤ ↑d / (↑m + 1)

Haussler–Littlestone–Warmuth Expected Error Bound [HausslerLittlestoneWarmuth1994, Theorem 2.3 (locator unverified)]: if C shatters no finite set of more than d points, oneInclusionLearner C is jointly measurable, and D is realizable by C, then on m i.i.d. examples from D, 𝔼[error D (oneInclusionLearner C S)] ≤ d / (m + 1).

theorem Cslib.MachineLearning.PACLearning.isPACLearnerFor_oneInclusionLearner {α : Type u_1} [MeasurableSpace α] {C : ConceptClass α Bool} {d m : ℕ} (hC : ∀ (W : Finset α), SetShatters C ↑W → W.card ≤ d) (hmeas : Measurable fun (p : LabeledSample α Bool m × α) => oneInclusionLearner C p.1 p.2) {ε δ : ↑(Set.Ioo 0 1)} (hm : ↑d ≤ ↑ε * ↑δ * (↑m + 1)) :

Haussler–Littlestone–Warmuth PAC Sample-Size Theorem [HausslerLittlestoneWarmuth1994, Theorem 2.3 (locator unverified)]: if C shatters no finite set of more than d points and oneInclusionLearner C is jointly measurable at sample size m, then oneInclusionLearner C is an (ε, δ)-PAC learner over realizableDistributions C whenever d ≤ ε δ (m + 1).

On a countable domain with measurable singletons, any class C of finite VC dimension achieves realizable PAC sample complexity at most ⌈vcDim C / (ε δ)⌉₊ via oneInclusionLearner C, eliminating the log (1 / ε) factor of empirical risk minimization at fixed confidence δ.