Documentation

CslibFrontier.MachineLearning.Rademacher.Linear

Rademacher complexity of bounded-norm linear predictors #

For a feature map φ : Z → E into a real inner product space, linearPredictors φ B is the class of linear predictors z ↦ ⟪w, φ z⟫ with ‖w‖ ≤ B. Its empirical Rademacher complexity on a sample S : Fin m → Z is at most B √(∑ i, ‖φ (S i)‖²) / m, hence at most B R / √m when every sample point has ‖φ (S i)‖ ≤ R [MohriRostamizadehTalwalkar2018, Theorem 5.10] [ShalevShwartzBenDavid2014, Lemma 26.10]. The proof is the textbook one: for a fixed sign vector σ, Cauchy–Schwarz bounds the supremum over the ball by B ‖∑ i, σ_i φ (S i)‖; Jensen's inequality moves the average inside a square root; and distinct Rademacher signs are uncorrelated (Cslib.BitString.expect_norm_sum_signVal_smul_sq). The bound does not depend on the dimension of E; taking φ = id gives the class {x ↦ ⟪w, x⟫ : ‖w‖ ≤ B} of the sources.

Combined with the fixed-margin bounds of CslibFrontier.MachineLearning.Rademacher.Margin, this gives the margin bound for linear classifiers [MohriRostamizadehTalwalkar2018, Corollary 5.11, (5.44)]: with probability at least 1 - δ, every w with ‖w‖ ≤ B has Pr_D[signVal y * ⟪w, φ x⟫ ≤ 0] ≤ R̂_{S, ρ}(w) + 2 B R / (ρ √m) + √(log (1 / δ) / (2 m)).

The Rademacher API works on finite domains, so the population statements assume Z finite (the sources allow any distribution supported on the ball of radius R); φ and E are arbitrary. Labels follow Rademacher/Margin: the signed margin of (x, y) is signVal y * h x.

Main definitions #

Main results #

References #

def Cslib.MachineLearning.linearPredictors {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {Z : Type u_2} (φ : Z → E) (B : ℝ) :
Set (Z → ℝ)

The class of linear predictors z ↦ ⟪w, φ z⟫ with weight vector of norm at most B, for a feature map φ : Z → E into a real inner product space.

theorem Cslib.MachineLearning.mem_linearPredictors {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {Z : Type u_2} {φ : Z → E} {B : ℝ} {h : Z → ℝ} :
h ∈ linearPredictors φ B ↔ ∃ (w : E), ‖w‖ ≤ B ∧ (fun (z : Z) => inner ℝ w (φ z)) = h
theorem Cslib.MachineLearning.abs_le_of_mem_linearPredictors {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {Z : Type u_2} {φ : Z → E} {B R : ℝ} (hφ : ∀ (z : Z), ‖φ z‖ ≤ R) {h : Z → ℝ} (hh : h ∈ linearPredictors φ B) (z : Z) :
|h z| ≤ B * R

A linear predictor with ‖w‖ ≤ B on features of norm at most R is bounded by B R.

theorem Cslib.MachineLearning.empiricalRademacherComplexity_linearPredictors_le_sqrt {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {Z : Type u_2} (φ : Z → E) {B : ℝ} (hB : 0 ≤ B) {m : ℕ} (S : Fin m → Z) :
empiricalRademacherComplexity (linearPredictors φ B) S ≤ B * √(∑ i : Fin m, ‖φ (S i)‖ ^ 2) / ↑m

Rademacher complexity of bounded-norm linear predictors, trace form: for B ≥ 0, the empirical Rademacher complexity of linearPredictors φ B on S is at most B √(∑ i, ‖φ (S i)‖²) / m. This is the intermediate bound in the proof of [MohriRostamizadehTalwalkar2018, Theorem 5.10].

theorem Cslib.MachineLearning.empiricalRademacherComplexity_linearPredictors_le {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {Z : Type u_2} (φ : Z → E) {B R : ℝ} (hB : 0 ≤ B) {m : ℕ} (S : Fin m → Z) (hS : ∀ (i : Fin m), ‖φ (S i)‖ ≤ R) :

Rademacher complexity of bounded-norm linear predictors [MohriRostamizadehTalwalkar2018, Theorem 5.10] [ShalevShwartzBenDavid2014, Lemma 26.10]: for B ≥ 0 and a sample whose features have norm at most R, the empirical Rademacher complexity of linearPredictors φ B is at most B R / √m.

theorem Cslib.MachineLearning.rademacherComplexity_linearPredictors_le {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {Z : Type u_2} [Fintype Z] (D : PMF Z) (φ : Z → E) {B R : ℝ} (hB : 0 ≤ B) (hφ : ∀ (z : Z), ‖φ z‖ ≤ R) (m : ℕ) :

The Rademacher complexity of linearPredictors φ B on a finite domain whose features have norm at most R is at most B R / √m.

theorem Cslib.MachineLearning.linearPredictors_margin_bound {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {Z : Type u_2} [Finite Z] (D : PMF (Z × Bool)) {m : ℕ} (hm : 0 < m) (φ : Z → E) {B R : ℝ} (hB : 0 ≤ B) (hφ : ∀ (z : Z), ‖φ z‖ ≤ R) {ρ : ℝ} (hρ : 0 < ρ) {δ : ℝ} (hδ : 0 < δ) :
((Probability.PMF.pi fun (x : Fin m) => D).toOuterMeasure {S : Fin m → Z × Bool | ∃ (w : E), ‖w‖ ≤ B ∧ empiricalMarginLoss ρ (fun (z : Z) => inner ℝ w (φ z)) S + 2 * B * R / (ρ * √↑m) + √(Real.log (1 / δ) / (2 * ↑m)) < (D.toOuterMeasure {p : Z × Bool | BitString.signVal p.2 * inner ℝ w (φ p.1) ≤ 0}).toReal}).toReal ≤ δ

Margin bound for linear classifiers [MohriRostamizadehTalwalkar2018, Corollary 5.11, (5.44)]: on a finite domain with features φ of norm at most R, for B ≥ 0, margin ρ > 0 and m > 0 independent draws from D : PMF (Z × Bool), with probability at least 1 - δ every weight vector with ‖w‖ ≤ B satisfies Pr_D[signVal y * ⟪w, φ x⟫ ≤ 0] ≤ R̂_{S, ρ}(w) + 2 B R / (ρ √m) + √(log (1 / δ) / (2 m)).

theorem Cslib.MachineLearning.linearPredictors_empirical_margin_bound {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {Z : Type u_2} [Finite Z] (D : PMF (Z × Bool)) {m : ℕ} (hm : 0 < m) (φ : Z → E) {B : ℝ} (hB : 0 ≤ B) {ρ : ℝ} (hρ : 0 < ρ) {δ : ℝ} (hδ : 0 < δ) :
((Probability.PMF.pi fun (x : Fin m) => D).toOuterMeasure {S : Fin m → Z × Bool | ∃ (w : E), ‖w‖ ≤ B ∧ empiricalMarginLoss ρ (fun (z : Z) => inner ℝ w (φ z)) S + 2 * B * √(∑ i : Fin m, ‖φ (S i).1‖ ^ 2) / (ρ * ↑m) + 3 * √(Real.log (2 / δ) / (2 * ↑m)) < (D.toOuterMeasure {p : Z × Bool | BitString.signVal p.2 * inner ℝ w (φ p.1) ≤ 0}).toReal}).toReal ≤ δ

Data-dependent margin bound for linear classifiers: on a finite domain, for B ≥ 0, margin ρ > 0 and m > 0 independent draws from D : PMF (Z × Bool), with probability at least 1 - δ every weight vector with ‖w‖ ≤ B satisfies `Pr_D[signVal y * ⟪w, φ x⟫ ≤ 0] ≤ R̂_{S, ρ}(w) + 2 B √(∑ i, ‖φ (S i).1‖²) / (ρ m)

  • 3 √(log (2 / δ) / (2 m)). This combines the trace form of [MohriRostamizadehTalwalkar2018, Theorem 5.10] with (5.40) of their Theorem 5.8; no bound R` on the features is assumed.