Documentation

CslibFrontier.MachineLearning.PACLearning.Halfspaces

The VC dimension of halfspaces #

For a linear map Φ : V →ₗ[ℝ] α → ℝ from a real vector space of parameters to real functions on α, positivityClass Φ is the binary class {x ↦ decide (0 < Φ v x) : v ∈ V}. If V is finite-dimensional, no set of more than finrank ℝ V points is shattered (card_le_finrank_of_setShatters_positivityClass): the evaluation functionals at such points are linearly dependent in the dual space, and labelling the points with positive coefficients true makes the vanishing combination strictly positive. If the parameters can realize every real vector of values at finrank ℝ V distinct points, those points are shattered, and the VC dimension equals finrank ℝ V (vcDim_positivityClass_eq). This is the argument of [ShalevShwartzBenDavid2014, Theorem 9.2] for an arbitrary finite-dimensional family of linear functionals.

Instances:

The source writes halfspaces as sign (⟪w, x⟫ + b); here a point is labelled true exactly when the value is strictly positive, as in the perceptron (CslibFrontier.MachineLearning.OnlineLearning.MistakeBound.Perceptron). The upper bound holds for this convention without any general-position assumption.

Main definitions #

Main results #

References #

noncomputable def Cslib.MachineLearning.PACLearning.positivityClass {α : Type u_1} {V : Type u_2} [AddCommGroup V] [Module ℝ V] (Φ : V →ₗ[ℝ] α → ℝ) :

The positivity class of a linear family Φ : V →ₗ[ℝ] α → ℝ: the classifiers x ↦ decide (0 < Φ v x) for v : V.

theorem Cslib.MachineLearning.PACLearning.mem_positivityClass {α : Type u_1} {V : Type u_2} [AddCommGroup V] [Module ℝ V] {Φ : V →ₗ[ℝ] α → ℝ} {c : α → Bool} :
c ∈ positivityClass Φ ↔ ∃ (v : V), (fun (x : α) => decide (0 < Φ v x)) = c

No more than finrank ℝ V points are shattered by the positivity class of a linear family on a finite-dimensional parameter space.

theorem Cslib.MachineLearning.PACLearning.setShatters_positivityClass_range {α : Type u_1} {V : Type u_2} [AddCommGroup V] [Module ℝ V] {ι : Type u_3} (Φ : V →ₗ[ℝ] α → ℝ) (x : ι → α) (hsurj : ∀ (t : ι → ℝ), ∃ (v : V), ∀ (i : ι), Φ v (x i) = t i) :

Points at which the parameters realize every vector of real values are shattered.

The positivity class of a linear family on a finite-dimensional space has finite VC dimension.

The VC dimension of the positivity class is at most finrank ℝ V.

theorem Cslib.MachineLearning.PACLearning.vcDim_positivityClass_eq {α : Type u_1} {V : Type u_2} [AddCommGroup V] [Module ℝ V] [FiniteDimensional ℝ V] {ι : Type u_3} [Fintype ι] (Φ : V →ₗ[ℝ] α → ℝ) (x : ι → α) (hx : Function.Injective x) (hcard : Fintype.card ι = Module.finrank ℝ V) (hsurj : ∀ (t : ι → ℝ), ∃ (v : V), ∀ (i : ι), Φ v (x i) = t i) :

The VC dimension of the positivity class is finrank ℝ V when finrank ℝ V distinct points admit every vector of values.

Halfspaces in Fin d → ℝ #

noncomputable def Cslib.MachineLearning.PACLearning.homogeneousForm (d : ℕ) :
(Fin d → ℝ) →ₗ[ℝ] (Fin d → ℝ) → ℝ

The linear family w ↦ (x ↦ w ⬝ᵥ x) of homogeneous linear functionals.

noncomputable def Cslib.MachineLearning.PACLearning.affineForm (d : ℕ) :
(Fin d → ℝ) × ℝ →ₗ[ℝ] (Fin d → ℝ) → ℝ

The linear family (w, b) ↦ (x ↦ w ⬝ᵥ x + b) of affine functionals.

Homogeneous halfspaces in Fin d → ℝ: the classifiers x ↦ decide (0 < w ⬝ᵥ x).

Affine halfspaces in Fin d → ℝ: the classifiers x ↦ decide (0 < w ⬝ᵥ x + b).

@[simp]
theorem Cslib.MachineLearning.PACLearning.affineForm_apply {d : ℕ} (p : (Fin d → ℝ) × ℝ) (x : Fin d → ℝ) :
(affineForm d) p x = p.1 ⬝ᵥ x + p.2

Homogeneous halfspaces as the positivity class of homogeneousForm, for applying the general positivityClass results.

Affine halfspaces as the positivity class of affineForm, for applying the general positivityClass results.

theorem Cslib.MachineLearning.PACLearning.mem_homogeneousHalfspaces {d : ℕ} {c : (Fin d → ℝ) → Bool} :
c ∈ homogeneousHalfspaces d ↔ ∃ (w : Fin d → ℝ), (fun (x : Fin d → ℝ) => decide (0 < w ⬝ᵥ x)) = c
theorem Cslib.MachineLearning.PACLearning.mem_affineHalfspaces {d : ℕ} {c : (Fin d → ℝ) → Bool} :
c ∈ affineHalfspaces d ↔ ∃ (w : Fin d → ℝ) (b : ℝ), (fun (x : Fin d → ℝ) => decide (0 < w ⬝ᵥ x + b)) = c

The VC dimension of homogeneous halfspaces in Fin d → ℝ is d [ShalevShwartzBenDavid2014, Theorem 9.2].

The VC dimension of affine halfspaces in Fin d → ℝ is d + 1 [ShalevShwartzBenDavid2014, Theorem 9.3].