Documentation

CslibFrontier.MachineLearning.OnlineLearning.HighProbabilityOnlineToBatch

High-probability online-to-batch conversion #

Run an online learner on an i.i.d. sample S = (z₀, …, z_{T-1}) from D. In round t it commits to a loss function f t S that depends only on the examples before round t, and then suffers the online loss f t S (S t). If every f t S takes values in [a, b], then with probability at least 1 - δ

(1 / T) ∑ t, ∫ f t S dD ≤ (1 / T) ∑ t, f t S (S t) + (b - a) √(ln (1 / δ) / (2 T))

(measureReal_average_integral_gt_le). The differences ∫ f t S dD - f t S (S t) are martingale differences of the natural filtration of the sample, and Hoeffding's lemma bounds each of them on an interval of length b - a. The Azuma–Hoeffding inequality under a product measure (ProbabilityTheory.measure_sum_ge_le_pi) then bounds their sum. This is the conversion of [CBCG04] for bounded losses; there the loss range is [0, 1] and the deviation term comes from Azuma's inequality (locator and constant unverified).

For the iterates w t S of an online learner and a loss ℓ with values in [a, b], the average true risk (1 / T) ∑ t, L_D (w t S) is at most the average online loss plus the same deviation term (measureReal_average_trueRisk_gt_le). For convex losses, Jensen's inequality turns a regret bound into a bound on the true risk of the average iterate (measureReal_trueRisk_average_gt_le). If the regret against u ∈ K is at most R on every sample and |ℓ w z - ℓ u z| ≤ c for w ∈ K, then with probability at least 1 - δ

L_D ((1 / T) ∑ t, w t S) ≤ L_D u + R / T + c √(2 ln (1 / δ) / T).

The in-expectation conversion uses only that w t S does not depend on S t. Here f t S must not depend on any of the examples S t, S (t + 1), …, so that the differences form a martingale. The faster rates for strongly convex losses and running time are not treated here.

Main results #

References #

theorem Cslib.MachineLearning.OnlineLearning.hasSubgaussianMGF_sum_integral_sub {Z : Type u_1} [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {T : ℕ} {f : Fin T → (Fin T → Z) → Z → ℝ} (hf : ∀ (t : Fin T), Measurable (Function.uncurry (f t))) (hfresh : ∀ (t s : Fin T), t ≤ s → ∀ (S : Fin T → Z) (z : Z), f t (Function.update S s z) = f t S) {a b : ℝ} (hab : ∀ (t : Fin T) (S : Fin T → Z) (z : Z), f t S z ∈ Set.Icc a b) :
ProbabilityTheory.HasSubgaussianMGF (fun (S : Fin T → Z) => ∑ t : Fin T, (∫ (z : Z), f t S z ∂D - f t S (S t))) (↑T * (‖b - a‖₊ / 2) ^ 2) (MeasureTheory.Measure.pi fun (x : Fin T) => D)

If f t S depends only on the examples before round t and takes values in [a, b], the sum of the differences ∫ f t S dD - f t S (S t) between expected and online losses has a sub-Gaussian moment generating function with parameter T ((b - a) / 2) ^ 2.

theorem Cslib.MachineLearning.OnlineLearning.measureReal_sum_integral_gt_le {Z : Type u_1} [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {T : ℕ} {f : Fin T → (Fin T → Z) → Z → ℝ} (hf : ∀ (t : Fin T), Measurable (Function.uncurry (f t))) (hfresh : ∀ (t s : Fin T), t ≤ s → ∀ (S : Fin T → Z) (z : Z), f t (Function.update S s z) = f t S) {a b : ℝ} (hab : ∀ (t : Fin T) (S : Fin T → Z) (z : Z), f t S z ∈ Set.Icc a b) {δ : ℝ} (hδ : 0 < δ) (hδ1 : δ ≤ 1) :
(MeasureTheory.Measure.pi fun (x : Fin T) => D).real {S : Fin T → Z | ∑ t : Fin T, f t S (S t) + (b - a) * √(↑T * Real.log (1 / δ) / 2) < ∑ t : Fin T, ∫ (z : Z), f t S z ∂D} ≤ δ

High-probability online-to-batch conversion, sum form. If f t S depends only on the examples before round t and takes values in [a, b], then for δ ∈ (0, 1], with probability at least 1 - δ, ∑ t, ∫ f t S dD ≤ ∑ t, f t S (S t) + (b - a) √(T ln (1 / δ) / 2).

theorem Cslib.MachineLearning.OnlineLearning.measureReal_average_integral_gt_le {Z : Type u_1} [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {T : ℕ} {f : Fin T → (Fin T → Z) → Z → ℝ} (hf : ∀ (t : Fin T), Measurable (Function.uncurry (f t))) (hfresh : ∀ (t s : Fin T), t ≤ s → ∀ (S : Fin T → Z) (z : Z), f t (Function.update S s z) = f t S) {a b : ℝ} (hab : ∀ (t : Fin T) (S : Fin T → Z) (z : Z), f t S z ∈ Set.Icc a b) {δ : ℝ} (hδ : 0 < δ) (hδ1 : δ ≤ 1) :
(MeasureTheory.Measure.pi fun (x : Fin T) => D).real {S : Fin T → Z | (↑T)⁻¹ * ∑ t : Fin T, f t S (S t) + (b - a) * √(Real.log (1 / δ) / (2 * ↑T)) < (↑T)⁻¹ * ∑ t : Fin T, ∫ (z : Z), f t S z ∂D} ≤ δ

High-probability online-to-batch conversion. If f t S depends only on the examples before round t and takes values in [a, b], then for δ ∈ (0, 1], with probability at least 1 - δ, the average expected loss (1 / T) ∑ t, ∫ f t S dD is at most the average online loss (1 / T) ∑ t, f t S (S t) plus (b - a) √(ln (1 / δ) / (2 T)).

theorem Cslib.MachineLearning.OnlineLearning.measureReal_average_trueRisk_gt_le {Z : Type u_1} [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {T : ℕ} {W : Type u_2} [MeasurableSpace W] {ℓ : W → Z → ℝ} (hℓ : Measurable (Function.uncurry ℓ)) {w : Fin T → (Fin T → Z) → W} (hwm : ∀ (t : Fin T), Measurable (w t)) (hfresh : ∀ (t s : Fin T), t ≤ s → ∀ (S : Fin T → Z) (z : Z), w t (Function.update S s z) = w t S) {a b : ℝ} (hab : ∀ (t : Fin T) (S : Fin T → Z) (z : Z), ℓ (w t S) z ∈ Set.Icc a b) {δ : ℝ} (hδ : 0 < δ) (hδ1 : δ ≤ 1) :
(MeasureTheory.Measure.pi fun (x : Fin T) => D).real {S : Fin T → Z | (↑T)⁻¹ * ∑ t : Fin T, ℓ (w t S) (S t) + (b - a) * √(Real.log (1 / δ) / (2 * ↑T)) < (↑T)⁻¹ * ∑ t : Fin T, trueRisk ℓ D (w t S)} ≤ δ

High-probability online-to-batch conversion for the iterates of an online learner. If the iterate w t S depends only on the examples before round t and the loss ℓ takes values in [a, b], then for δ ∈ (0, 1], with probability at least 1 - δ, the average true risk (1 / T) ∑ t, L_D (w t S) is at most the average online loss (1 / T) ∑ t, ℓ (w t S) (S t) plus (b - a) √(ln (1 / δ) / (2 T)).

theorem Cslib.MachineLearning.OnlineLearning.measureReal_trueRisk_average_gt_le {Z : Type u_1} [MeasurableSpace Z] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {T : ℕ} (hT : 0 < T) {E : Type u_2} [AddCommGroup E] [Module ℝ E] [MeasurableSpace E] {K : Set E} (hK : Convex ℝ K) {ℓ : E → Z → ℝ} (hℓ : Measurable (Function.uncurry ℓ)) (hconv : ∀ (z : Z), ConvexOn ℝ K fun (w : E) => ℓ w z) {u : E} (hui : MeasureTheory.Integrable (ℓ u) D) {c : ℝ} (hc : ∀ w ∈ K, ∀ (z : Z), |ℓ w z - ℓ u z| ≤ c) {w : Fin T → (Fin T → Z) → E} (hwK : ∀ (t : Fin T) (S : Fin T → Z), w t S ∈ K) (hwm : ∀ (t : Fin T), Measurable (w t)) (hfresh : ∀ (t s : Fin T), t ≤ s → ∀ (S : Fin T → Z) (z : Z), w t (Function.update S s z) = w t S) {R : ℝ} (hR : ∀ (S : Fin T → Z), ∑ t : Fin T, (ℓ (w t S) (S t) - ℓ u (S t)) ≤ R) {δ : ℝ} (hδ : 0 < δ) (hδ1 : δ ≤ 1) :
(MeasureTheory.Measure.pi fun (x : Fin T) => D).real {S : Fin T → Z | trueRisk ℓ D u + R / ↑T + c * √(2 * Real.log (1 / δ) / ↑T) < trueRisk ℓ D ((↑T)⁻¹ • ∑ t : Fin T, w t S)} ≤ δ

High-probability online-to-batch conversion for convex losses. Let ℓ · z be convex on a convex set K, let u ∈ K with ℓ u integrable, and let |ℓ w z - ℓ u z| ≤ c for w ∈ K. If the iterates w t S ∈ K depend only on the examples before round t and their regret against u is at most R on every sample, then for δ ∈ (0, 1], with probability at least 1 - δ, the average iterate has true risk at most L_D u + R / T + c √(2 ln (1 / δ) / T).