Documentation

CslibFrontier.MachineLearning.PACLearning.DoubleSample

Double samples and coordinate swaps #

The double-sample (ghost-sample) argument bounds the probability of an event about one i.i.d. sample S by the probability of an event J about a pair (S, T) of independent samples [ShalevShwartzBenDavid2014, Section 28.3]. It has two measure-theoretic steps, collected here.

Applications bound the number of swaps that land in J combinatorially; see EpsilonNet.lean. The domain Z is an arbitrary measurable space and the sample measures are σ-finite (s-finite for the second sample of the ghost-sample bound). The swap-averaging and ghost-sample bounds assume the event J is measurable; on a countable domain with measurable singletons every set is measurable (.of_discrete).

Main definitions #

Main results #

References #

Swapping coordinates #

def Cslib.MachineLearning.PACLearning.swapSamples {Z : Type u_1} {m : ℕ} (σ : Fin m → Bool) (z : (Fin m → Z) × (Fin m → Z)) :
(Fin m → Z) × (Fin m → Z)

Swap the coordinates i with σ i = true between the two samples of a double sample.

@[simp]
theorem Cslib.MachineLearning.PACLearning.fst_swapSamples_apply {Z : Type u_1} {m : ℕ} (σ : Fin m → Bool) (z : (Fin m → Z) × (Fin m → Z)) (i : Fin m) :
(swapSamples σ z).1 i = if σ i = true then z.2 i else z.1 i
@[simp]
theorem Cslib.MachineLearning.PACLearning.snd_swapSamples_apply {Z : Type u_1} {m : ℕ} (σ : Fin m → Bool) (z : (Fin m → Z) × (Fin m → Z)) (i : Fin m) :
(swapSamples σ z).2 i = if σ i = true then z.1 i else z.2 i
@[simp]
theorem Cslib.MachineLearning.PACLearning.swapSamples_swapSamples {Z : Type u_1} {m : ℕ} (σ : Fin m → Bool) (z : (Fin m → Z) × (Fin m → Z)) :

Swapping coordinates preserves the product of two i.i.d. sample distributions, on any measurable space and for any σ-finite μ. Under the identification of a double sample with a sample of pairs, swapSamples σ swaps the pairs at the coordinates i with σ i = true, and each such swap preserves μ × μ.

theorem Cslib.MachineLearning.PACLearning.measure_preimage_swapSamples {Z : Type u_1} [MeasurableSpace Z] (μ : MeasureTheory.Measure Z) [MeasureTheory.SigmaFinite μ] {m : ℕ} (σ : Fin m → Bool) (J : Set ((Fin m → Z) × (Fin m → Z))) :
((MeasureTheory.Measure.pi fun (x : Fin m) => μ).prod (MeasureTheory.Measure.pi fun (x : Fin m) => μ)) (swapSamples σ ⁻¹' J) = ((MeasureTheory.Measure.pi fun (x : Fin m) => μ).prod (MeasureTheory.Measure.pi fun (x : Fin m) => μ)) J

Swapping coordinates preserves the probability of every set of double samples, measurable or not, under the product of two i.i.d. sample distributions.

theorem Cslib.MachineLearning.PACLearning.lintegral_card_filter_swapSamples_mem {Z : Type u_1} [MeasurableSpace Z] (μ : MeasureTheory.Measure Z) [MeasureTheory.SigmaFinite μ] {m : ℕ} {J : Set ((Fin m → Z) × (Fin m → Z))} (hJ : MeasurableSet J) :
∫⁻ (z : (Fin m → Z) × (Fin m → Z)), ↑{σ : Fin m → Bool | swapSamples σ z ∈ J}.card ∂(MeasureTheory.Measure.pi fun (x : Fin m) => μ).prod (MeasureTheory.Measure.pi fun (x : Fin m) => μ) = 2 ^ m * ((MeasureTheory.Measure.pi fun (x : Fin m) => μ).prod (MeasureTheory.Measure.pi fun (x : Fin m) => μ)) J

Swap averaging: summing over all 2 ^ m swaps, the probability of a measurable set J under μ^m × μ^m, times 2 ^ m, is the expected number of swaps of a random double sample that land in J.

theorem Cslib.MachineLearning.PACLearning.measure_prod_le_of_card_filter_swapSamples_mem_le {Z : Type u_1} [MeasurableSpace Z] (μ : MeasureTheory.Measure Z) [MeasureTheory.IsProbabilityMeasure μ] {m : ℕ} {J : Set ((Fin m → Z) × (Fin m → Z))} (hJ : MeasurableSet J) (K : ENNReal) (hK : ∀ (z : (Fin m → Z) × (Fin m → Z)), ↑{σ : Fin m → Bool | swapSamples σ z ∈ J}.card ≤ 2 ^ m * K) :
((MeasureTheory.Measure.pi fun (x : Fin m) => μ).prod (MeasureTheory.Measure.pi fun (x : Fin m) => μ)) J ≤ K

Swap counting: if J is measurable and for every double sample z at most 2 ^ m K of the 2 ^ m swaps of z land in J, then J has probability at most K under μ^m × μ^m.

The ghost sample #

theorem Cslib.MachineLearning.PACLearning.mul_measure_le_measure_prod {Z : Type u_1} [MeasurableSpace Z] {m : ℕ} (ν ν' : MeasureTheory.Measure (Fin m → Z)) [MeasureTheory.SFinite ν'] (B : Set (Fin m → Z)) {J : Set ((Fin m → Z) × (Fin m → Z))} (hJ : MeasurableSet J) (c : ENNReal) (hfib : ∀ S ∈ B, c ≤ ν' (Prod.mk S ⁻¹' J)) :
c * ν B ≤ (ν.prod ν') J

Ghost-sample bound: if J is measurable and every sample S ∈ B extends to a double sample in J with probability at least c over an independent second sample from ν', then c ν B ≤ (ν × ν') J.

theorem Cslib.MachineLearning.PACLearning.measure_le_two_mul_measure_prod {Z : Type u_1} [MeasurableSpace Z] {m : ℕ} (ν ν' : MeasureTheory.Measure (Fin m → Z)) [MeasureTheory.SFinite ν'] (B : Set (Fin m → Z)) {J : Set ((Fin m → Z) × (Fin m → Z))} (hJ : MeasurableSet J) (hfib : ∀ S ∈ B, 1 / 2 ≤ ν' (Prod.mk S ⁻¹' J)) :
ν B ≤ 2 * (ν.prod ν') J

The ghost-sample bound at c = 1 / 2: ν B ≤ 2 (ν × ν') J.