Documentation

CslibFrontier.MachineLearning.OnlineLearning.ConvexOnlineToBatch

Online-to-batch conversion for convex losses #

Run an online learner on an i.i.d. sample S = (z₀, …, z_{T-1}) from D. In round t it plays a point w t S of a convex set K and then suffers the loss ℓ (w t S) (S t). Since the learner picks w t S before seeing S t, the online loss ℓ (w t S) (S t) is an unbiased estimate of the true risk L_D (w t S). By Jensen's inequality the average point w̄ S = (1 / T) ∑ t, w t S then has expected true risk at most the expected average online loss; with a regret bound ∑ t, (ℓ (w t S) (S t) - ℓ u (S t)) ≤ R against u ∈ K this gives 𝔼_S L_D (w̄ S) ≤ L_D u + R / T. This is the in-expectation form of the conversion of [CBCG04] and the argument of [ShalevShwartzBenDavid2014, Theorem 14.8] (locator unverified).

The only property of the learner that is used is that w t S does not depend on S t (hfresh), which holds when w t S depends only on the examples before round t. Without it the bound fails: for the absolute loss |w - z| on ℝ, playing the current example has online loss 0, while every point has positive true risk under a nondegenerate D. The conditional step is MeasureTheory.integral_apply_eval_eq_integral_integral: it integrates out S t under the product measure, with no conditional expectations. Integrability comes from a single integrable b that dominates |ℓ w z| for all w ∈ K.

The bounds are in expectation. High-probability versions (via martingale concentration), the faster rates for strongly convex losses, and running time are not treated here.

Main results #

References #

theorem Cslib.MachineLearning.OnlineLearning.integral_trueRisk_average_le {Z : Type u_1} {E : Type u_2} [MeasurableSpace Z] [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [SecondCountableTopology E] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {K : Set E} {ℓ : E → Z → ℝ} {b : Z → ℝ} {T : ℕ} (hT : 0 < T) (hK : Convex ℝ K) (hℓ : Measurable (Function.uncurry ℓ)) (hconv : ∀ (z : Z), ConvexOn ℝ K fun (w : E) => ℓ w z) (hb : MeasureTheory.Integrable b D) (hbound : ∀ w ∈ K, ∀ (z : Z), |ℓ w z| ≤ b z) {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 : Fin T) (S : Fin T → Z) (z : Z), w t (Function.update S t z) = w t S) :
(∫ (S : Fin T → Z), trueRisk ℓ D ((↑T)⁻¹ • ∑ t : Fin T, w t S) ∂MeasureTheory.Measure.pi fun (x : Fin T) => D) ≤ (↑T)⁻¹ * ∑ t : Fin T, ∫ (S : Fin T → Z), ℓ (w t S) (S t) ∂MeasureTheory.Measure.pi fun (x : Fin T) => D

Online-to-batch conversion for convex losses. Let ℓ · z be convex on a convex set K and dominated there by an integrable b, and let w t S ∈ K be measurable in the sample S and independent of the example S t. Then the expected true risk of the average (1 / T) ∑ t, w t S is at most the average over t of the expected online loss ℓ (w t S) (S t).

theorem Cslib.MachineLearning.OnlineLearning.integral_trueRisk_average_le_add {Z : Type u_1} {E : Type u_2} [MeasurableSpace Z] [NormedAddCommGroup E] [NormedSpace ℝ E] [MeasurableSpace E] [BorelSpace E] [SecondCountableTopology E] {D : MeasureTheory.Measure Z} [MeasureTheory.IsProbabilityMeasure D] {K : Set E} {ℓ : E → Z → ℝ} {b : Z → ℝ} {T : ℕ} (hT : 0 < T) (hK : Convex ℝ K) (hℓ : Measurable (Function.uncurry ℓ)) (hconv : ∀ (z : Z), ConvexOn ℝ K fun (w : E) => ℓ w z) (hb : MeasureTheory.Integrable b D) (hbound : ∀ w ∈ K, ∀ (z : Z), |ℓ w z| ≤ b z) {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 : Fin T) (S : Fin T → Z) (z : Z), w t (Function.update S t z) = w t S) {u : E} (hu : u ∈ K) {R : ℝ} (hR : ∀ (S : Fin T → Z), ∑ t : Fin T, (ℓ (w t S) (S t) - ℓ u (S t)) ≤ R) :
(∫ (S : Fin T → Z), trueRisk ℓ D ((↑T)⁻¹ • ∑ t : Fin T, w t S) ∂MeasureTheory.Measure.pi fun (x : Fin T) => D) ≤ trueRisk ℓ D u + R / ↑T

Online-to-batch conversion for convex losses, regret form (in expectation; [CBCG04]). Under the hypotheses of integral_trueRisk_average_le, if the learner's regret against u ∈ K is at most R on every sample, then the expected true risk of the average point is at most L_D u + R / T.