Documentation

CslibFrontier.MachineLearning.Rademacher.UniformMargin

Uniform margin generalization bounds via Rademacher complexity #

The margin generalization bounds in CslibFrontier.MachineLearning.Rademacher.Margin hold for a margin threshold ρ > 0 fixed before the sample is drawn. Stratifying (0, r] by the geometric grid ρₙ = r / 2^(n + 1) with failure-probability weights δₙ = δ / ((n + 1) (n + 2)) (∑' n, 1 / ((n + 1) (n + 2)) = 1 by telescoping) and taking a countable union bound upgrades those fixed-ρ bounds to hold simultaneously for all h ∈ H and all ρ ∈ (0, r] [MohriRostamizadehTalwalkar2018, Theorem 5.9] [KP02].

For any ρ ∈ (0, r], choosing n : ℕ with r / 2^(n + 1) < ρ ≤ r / 2^n yields:

Splitting the square root with √(a + b) ≤ √a + √b gives:

Main results #

References #

Monotonicity in the margin parameter #

theorem Cslib.MachineLearning.marginLoss_mono_of_pos {ρ₁ ρ₂ : ℝ} (hρ₁ : 0 < ρ₁) (hρ : ρ₁ ≤ ρ₂) (u : ℝ) :
marginLoss ρ₁ u ≤ marginLoss ρ₂ u

The ρ-margin loss Φ_ρ(u) is monotone in ρ > 0: a larger margin threshold ρ₂ ≥ ρ₁ > 0 penalizes every point at least as heavily.

theorem Cslib.MachineLearning.empiricalMarginLoss_mono_of_pos {α : Type u_1} {ρ₁ ρ₂ : ℝ} (hρ₁ : 0 < ρ₁) (hρ : ρ₁ ≤ ρ₂) (h : α → ℝ) {m : ℕ} (S : Fin m → α × Bool) :

The empirical ρ-margin loss R̂_{S, ρ}(h) is monotone in ρ > 0.

Dyadic stratification helpers #

Uniform-in-ρ margin generalization bounds #

theorem Cslib.MachineLearning.uniform_rademacherComplexity_margin_bound {α : Type u_1} [Fintype α] (D : PMF (α × Bool)) {m : ℕ} (hm : 0 < m) {H : Set (α → ℝ)} {B : ℝ} (hH : ∀ h ∈ H, ∀ (x : α), |h x| ≤ B) {r : ℝ} (hr : 0 < r) {δ : ℝ} (hδ : 0 < δ) :
((Probability.PMF.pi fun (x : Fin m) => D).toOuterMeasure {S : Fin m → α × Bool | ∃ h ∈ H, ∃ ρ ∈ Set.Ioc 0 r, empiricalMarginLoss ρ h S + 4 / ρ * rademacherComplexity (PMF.map Prod.fst D) H m + √(Real.log (Real.logb 2 (2 * r / ρ)) / ↑m) + √(Real.log (2 / δ) / (2 * ↑m)) < (D.toOuterMeasure {p : α × Bool | BitString.signVal p.2 * h p.1 ≤ 0}).toReal}).toReal ≤ δ

Uniform margin generalization bound [MohriRostamizadehTalwalkar2018, Theorem 5.9] [KP02]: for a uniformly bounded class H : Set (α → ℝ) on a finite domain α, a scale r > 0, m > 0 independent draws from D : PMF (α × Bool), and δ > 0, with probability at least 1 - δ every h ∈ H and every ρ ∈ (0, r] simultaneously satisfy

Pr_D[signVal y * h x ≤ 0] ≤ R̂_{S, ρ}(h) + (4 / ρ) R_m(H)
  + √(log (log₂ (2 r / ρ)) / m) + √(log (2 / δ) / (2 m)).

Obtained by a countable union bound over rademacherComplexity_margin_bound at dyadic scales ρₙ = r / 2^(n + 1) with failure budgets δₙ = δ / ((n + 1) (n + 2)).

theorem Cslib.MachineLearning.uniform_empiricalRademacherComplexity_margin_bound {α : Type u_1} [Finite α] (D : PMF (α × Bool)) {m : ℕ} (hm : 0 < m) {H : Set (α → ℝ)} {B : ℝ} (hH : ∀ h ∈ H, ∀ (x : α), |h x| ≤ B) {r : ℝ} (hr : 0 < r) {δ : ℝ} (hδ : 0 < δ) :
((Probability.PMF.pi fun (x : Fin m) => D).toOuterMeasure {S : Fin m → α × Bool | ∃ h ∈ H, ∃ ρ ∈ Set.Ioc 0 r, (empiricalMarginLoss ρ h S + 4 / ρ * empiricalRademacherComplexity H fun (i : Fin m) => (S i).1) + 3 * √(Real.log (Real.logb 2 (2 * r / ρ)) / ↑m) + 3 * √(Real.log (4 / δ) / (2 * ↑m)) < (D.toOuterMeasure {p : α × Bool | BitString.signVal p.2 * h p.1 ≤ 0}).toReal}).toReal ≤ δ

Data-dependent uniform margin generalization bound [MohriRostamizadehTalwalkar2018, Theorem 5.9] [KP02]: for a uniformly bounded class H : Set (α → ℝ) on a finite domain α, a scale r > 0, m > 0 independent draws from D : PMF (α × Bool), and δ > 0, with probability at least 1 - δ every h ∈ H and every ρ ∈ (0, r] simultaneously satisfy

Pr_D[signVal y * h x ≤ 0] ≤ R̂_{S, ρ}(h) + (4 / ρ) R̂_{S_X}(H)
  + 3 √(log (log₂ (2 r / ρ)) / m) + 3 √(log (4 / δ) / (2 m)).

Here S_X is the unlabeled sample fun i => (S i).1. Note the constant 4 / δ arises from substituting δₙ = δ / ((n + 1) (n + 2)) into log (2 / δₙ).