Documentation

CslibFrontier.MachineLearning.OnlineLearning.DoublingTrick

Unknown-horizon doubling trick for online experts algorithms #

This module formalizes the generic "guess and double" (doubling trick) reduction converting any family of horizon-indexed online experts algorithms H m with O(√m) external regret into a single horizon-free causal online algorithm doublingPlay H achieving O(√T) external regret for every horizon T : ℕ simultaneously ([BlumMansour2007AGT, §4.3.2 note after Theorem 4.5, p. 85, and §4.3.3 footnote 1, p. 87]).

Construction #

Rounds t : ℕ are partitioned into geometric epochs k = 0, 1, 2, … of length 2 ^ k, where epoch k covers [2 ^ k - 1, 2 ^ (k + 1) - 1). Thus round t lies in epoch k = Nat.log 2 (t + 1) at in-epoch offset t - (2 ^ k - 1) < 2 ^ k, and doublingPlay H runs a fresh instance of H (2 ^ k) on the shifted epoch losses s ↦ ℓ (2 ^ k - 1 + s).

Main definitions #

Main results #

References #

Generic geometric-epoch doubling wrapper #

def Cslib.MachineLearning.OnlineLearning.Experts.doublingPlay {ι : Type u_1} (H : ℕ → (ℕ → ι → ℝ) → ℕ → ι → ℝ) (ℓ : ℕ → ι → ℝ) (t : ℕ) :
ι → ℝ

Doubling-trick wrapper [BlumMansour2007AGT, §4.3.2 note, p. 85, and §4.3.3 footnote 1, p. 87]: partitions rounds into geometric epochs k = 0, 1, 2, … of length 2 ^ k covering [2 ^ k - 1, 2 ^ (k + 1) - 1), running a fresh instance of H (2 ^ k) in epoch k.

theorem Cslib.MachineLearning.OnlineLearning.Experts.doublingPlay_epoch {ι : Type u_1} (H : ℕ → (ℕ → ι → ℝ) → ℕ → ι → ℝ) (ℓ : ℕ → ι → ℝ) {k r : ℕ} (hr : r < 2 ^ k) :
doublingPlay H ℓ (2 ^ k - 1 + r) = H (2 ^ k) (fun (s : ℕ) => ℓ (2 ^ k - 1 + s)) r

For r < 2 ^ k, doublingPlay H ℓ (2 ^ k - 1 + r) evaluates epoch k's learner H (2 ^ k) at in-epoch step r.

theorem Cslib.MachineLearning.OnlineLearning.Experts.isOnlineAlgorithm_doublingPlay {ι : Type u_1} [Fintype ι] {H : ℕ → (ℕ → ι → ℝ) → ℕ → ι → ℝ} (hH : ∀ (m : ℕ), IsOnlineAlgorithm (H m)) :

If every horizon-indexed learner H m is a causal online algorithm, then doublingPlay H is a single horizon-free causal online algorithm.

theorem Cslib.MachineLearning.OnlineLearning.Experts.doublingPlay_regret_le_sqrt {ι : Type u_1} [Fintype ι] {H : ℕ → (ℕ → ι → ℝ) → ℕ → ι → ℝ} (hH : ∀ (m : ℕ), IsOnlineAlgorithm (H m)) {C : ℝ} (hC : 0 ≤ C) (hreg : ∀ (m : ℕ) (c : ℕ → ι → ℝ), (∀ s < m, ∀ (i : ι), c s i ∈ Set.Icc 0 1) → ∀ (i : ι), ∑ s ∈ Finset.range m, ∑ j : ι, H m c s j * c s j ≤ ∑ s ∈ Finset.range m, c s i + C * √↑m) {ℓ : ℕ → ι → ℝ} {T : ℕ} (hℓ : ∀ t < T, ∀ (i : ι), ℓ t i ∈ Set.Icc 0 1) (i : ι) :
∑ t ∈ Finset.range T, ∑ j : ι, doublingPlay H ℓ t j * ℓ t j ≤ ∑ t ∈ Finset.range T, ℓ t i + (2 + √2) * C * √↑T

Generic horizon-free √T doubling-trick regret bound [BlumMansour2007AGT, §4.3.2 note, p. 85, and §4.3.3 footnote 1, p. 87]: if every horizon-indexed causal online algorithm H m achieves external regret at most C * √m (0 ≤ C) on [0, 1] losses, then the single horizon-free algorithm doublingPlay H achieves external regret at most (2 + √2) * C * √T for every horizon T : ℕ.

Horizon-free Polynomial Weights (doublingMW) #

noncomputable def Cslib.MachineLearning.OnlineLearning.Experts.doublingMW {ι : Type u_1} [Fintype ι] :
(ℕ → ι → ℝ) → ℕ → ι → ℝ

Horizon-free Polynomial Weights (doublingPlay instantiated with capped mwFactor), achieving O(√(T ln N)) external regret for every horizon T without knowing T in advance [BlumMansour2007AGT, §4.3.2 note, p. 85, and §4.3.3 footnote 1, p. 87].

theorem Cslib.MachineLearning.OnlineLearning.Experts.doublingMW_regret_le_sqrt {ι : Type u_1} [Fintype ι] [Nonempty ι] {ℓ : ℕ → ι → ℝ} {T : ℕ} (hℓ : ∀ t < T, ∀ (i : ι), ℓ t i ∈ Set.Icc 0 1) (i : ι) :
∑ t ∈ Finset.range T, ∑ j : ι, doublingMW ℓ t j * ℓ t j ≤ ∑ t ∈ Finset.range T, ℓ t i + (4 + 2 * √2) * √(↑T * Real.log ↑(Fintype.card ι))

Horizon-free external regret bound for doublingMW: for every horizon T : ℕ, every [0, 1]-valued loss sequence ℓ, and every expert i, ∑ t < T, ⟨p t, ℓ t⟩ ≤ ∑ t < T, ℓ t i + (4 + 2 * √2) * √(T * ln N).