Documentation

CslibFrontier.MachineLearning.OnlineLearning.EntropicFTRL

Entropic follow the regularized leader and Hedge #

Over the finite probability simplex simplex ι = {p : ι → ℝ | (∀ i, 0 ≤ p i) ∧ ∑ i, p i = 1}, negative Shannon entropy in nats negEntropy p = ∑ i, p i * Real.log (p i) (with 0 * log 0 = 0) is 1-strongly convex with respect to the ℓ¹ norm v ↦ ∑ i, |v i| (strongConvexOnWrt_negEntropy), proved directly from Pinsker's inequality Cslib.Probability.PMF.two_mul_dist_sq_le_sum_mul_log_div applied to (p, m) and (q, m) at the convex combination m = a • p + b • q, requiring no strict-positivity boundary assumption.

With linear losses p ↦ ∑ i, p i * loss t i and entropic regularizers p ↦ negEntropy p / η t (η t > 0), the unique FTRL minimizer over simplex ι is explicitly the exponential-weights distribution entropicFTRLProb η loss t i = exp (-η t ∑ s < t, loss s i) / Z t (isTimeVaryingFTRL_entropic_iff), proved directly from Gibbs' inequality Cslib.Probability.PMF.sum_mul_log_div_nonneg and its equality case Cslib.Probability.PMF.sum_mul_log_div_eq_zero_iff. For a constant learning rate η > 0, this recovers Experts.prob (Experts.hedgeFactor η) loss (entropicFTRLProb_const_eq_hedge, isFTRL_hedge_iff).

Applying the FTRL regret bounds with ℓ¹-norm strong convexity (σ = 1) and ℓ∞-bounded losses |loss t i| ≤ L yields:

Main definitions #

Main results #

References #

Exact section and corollary numbers below beyond those verified in FTRL.lean are unverified against primary PDFs.

@[reducible, inline]

The finite probability simplex {p : ι → ℝ | (∀ i, 0 ≤ p i) ∧ ∑ i, p i = 1}.

noncomputable def Cslib.MachineLearning.OnlineLearning.OCO.negEntropy {ι : Type u_1} [Fintype ι] (p : ι → ℝ) :

Negative Shannon entropy in nats on ι → ℝ: ∑ i, p i * Real.log (p i) (with 0 * log 0 = 0 automatically from Real.log 0 = 0).

theorem Cslib.MachineLearning.OnlineLearning.OCO.negEntropy_def {ι : Type u_1} [Fintype ι] (p : ι → ℝ) :
negEntropy p = ∑ i : ι, p i * Real.log (p i)

Negative entropy is nonpositive on the probability simplex.

Negative entropy on the probability simplex is at least -Real.log (Fintype.card ι).

On simplex ι, negative entropy oscillates by at most Real.log (Fintype.card ι).

Strong convexity of negative entropy on the simplex (via Pinsker's inequality): negEntropy is 1-strongly convex on simplex ι with respect to the ℓ¹ norm v ↦ ∑ i, |v i|.

noncomputable def Cslib.MachineLearning.OnlineLearning.OCO.entropicFTRLProb {ι : Type u_1} [Fintype ι] (η : ℕ → ℝ) (loss : ℕ → ι → ℝ) (t : ℕ) (i : ι) :

Exponential-weights distribution played by entropic FTRL at round t with learning rate η t on cumulative losses ∑ s < t, loss s: p_t(i) = exp (-η t * ∑ s < t, loss s i) / ∑ j, exp (-η t * ∑ s < t, loss s j).

theorem Cslib.MachineLearning.OnlineLearning.OCO.entropicFTRLProb_def {ι : Type u_1} [Fintype ι] (η : ℕ → ℝ) (loss : ℕ → ι → ℝ) (t : ℕ) (i : ι) :
entropicFTRLProb η loss t i = Real.exp (-(η t * ∑ s ∈ Finset.range t, loss s i)) / ∑ j : ι, Real.exp (-(η t * ∑ s ∈ Finset.range t, loss s j))
theorem Cslib.MachineLearning.OnlineLearning.OCO.entropicFTRLProb_pos {ι : Type u_1} [Fintype ι] [Nonempty ι] (η : ℕ → ℝ) (loss : ℕ → ι → ℝ) (t : ℕ) (i : ι) :
0 < entropicFTRLProb η loss t i
theorem Cslib.MachineLearning.OnlineLearning.OCO.entropicFTRLProb_mem_simplex {ι : Type u_1} [Fintype ι] [Nonempty ι] (η : ℕ → ℝ) (loss : ℕ → ι → ℝ) (t : ℕ) :
theorem Cslib.MachineLearning.OnlineLearning.OCO.entropicFTRLProb_const_eq_hedge {ι : Type u_1} [Fintype ι] (η : ℝ) (loss : ℕ → ι → ℝ) (t : ℕ) :
entropicFTRLProb (fun (x : ℕ) => η) loss t = Experts.prob (Experts.hedgeFactor η) loss t

With a constant learning rate η, entropicFTRLProb coincides pointwise with Hedge Experts.prob (Experts.hedgeFactor η) loss.

theorem Cslib.MachineLearning.OnlineLearning.OCO.isTimeVaryingFTRL_entropic_iff {ι : Type u_1} [Fintype ι] [Nonempty ι] {η : ℕ → ℝ} (hη : ∀ (t : ℕ), 0 < η t) (loss x : ℕ → ι → ℝ) :
IsTimeVaryingFTRL (simplex ι) (fun (t : ℕ) (p : ι → ℝ) => negEntropy p / η t) (fun (t : ℕ) (p : ι → ℝ) => ∑ i : ι, p i * loss t i) x ↔ x = entropicFTRLProb η loss

Entropic FTRL uniquely produces the exponential-weights distribution (via Gibbs' inequality): for [Nonempty ι] and positive learning rates η, a sequence x is a time-varying FTRL run for ψ t p = negEntropy p / η t and linear losses p ↦ ∑ i, p i * loss t i on simplex ι iff x = entropicFTRLProb η loss.

theorem Cslib.MachineLearning.OnlineLearning.OCO.isFTRL_hedge_iff {ι : Type u_1} [Fintype ι] [Nonempty ι] {η : ℝ} (hη : 0 < η) (loss x : ℕ → ι → ℝ) :
IsFTRL (simplex ι) (fun (p : ι → ℝ) => negEntropy p / η) (fun (t : ℕ) (p : ι → ℝ) => ∑ i : ι, p i * loss t i) x ↔ x = Experts.prob (Experts.hedgeFactor η) loss

Hedge is entropic FTRL: for [Nonempty ι] and constant η > 0, a sequence x is an FTRL run for p ↦ negEntropy p / η and linear losses p ↦ ∑ i, p i * loss t i on simplex ι iff x = Experts.prob (Experts.hedgeFactor η) loss.

theorem Cslib.MachineLearning.OnlineLearning.OCO.hedge_regret_le_of_ftrl {ι : Type u_1} [Fintype ι] [Nonempty ι] {η L : ℝ} (hη : 0 < η) {loss : ℕ → ι → ℝ} {T : ℕ} (hloss : ∀ t < T, ∀ (i : ι), |loss t i| ≤ L) {u : ι → ℝ} (hu : u ∈ simplex ι) :
∑ t ∈ Finset.range T, (∑ i : ι, Experts.prob (Experts.hedgeFactor η) loss t i * loss t i - ∑ i : ι, u i * loss t i) ≤ Real.log ↑(Fintype.card ι) / η + η * ↑T * L ^ 2 / 2

Hedge regret via entropic FTRL: for [Nonempty ι], any η > 0, losses with |loss t i| ≤ L for t < T, and any comparator distribution u ∈ simplex ι, ∑ t < T, (⟨p t, loss t⟩ - ⟨u, loss t⟩) ≤ log n / η + η * T * L ^ 2 / 2. Unlike Experts.hedge_regret_le, this holds for every η > 0 without assuming η ≤ 1.

theorem Cslib.MachineLearning.OnlineLearning.OCO.hedge_regret_le_sqrt_two {ι : Type u_1} [Fintype ι] (hn : 2 ≤ Fintype.card ι) {loss : ℕ → ι → ℝ} {T : ℕ} (hT : 0 < T) (hloss : ∀ t < T, ∀ (i : ι), |loss t i| ≤ 1) {u : ι → ℝ} (hu : u ∈ simplex ι) :
∑ t ∈ Finset.range T, (∑ i : ι, Experts.prob (Experts.hedgeFactor √(2 * Real.log ↑(Fintype.card ι) / ↑T)) loss t i * loss t i - ∑ i : ι, u i * loss t i) ≤ √(2 * ↑T * Real.log ↑(Fintype.card ι))

Hedge √(2 T ln n) regret bound via entropic FTRL: for n ≥ 2 experts, T ≥ 1 rounds, and losses in [-1, 1], Hedge with η = √(2 * log n / T) achieves regret at most √(2 * T * log n) against every comparator distribution u ∈ simplex ι.

theorem Cslib.MachineLearning.OnlineLearning.OCO.hedge_regret_le_sqrt_two_expert {ι : Type u_1} [Fintype ι] (hn : 2 ≤ Fintype.card ι) {loss : ℕ → ι → ℝ} {T : ℕ} (hT : 0 < T) (hloss : ∀ t < T, ∀ (i : ι), |loss t i| ≤ 1) (j : ι) :
∑ t ∈ Finset.range T, ∑ i : ι, Experts.prob (Experts.hedgeFactor √(2 * Real.log ↑(Fintype.card ι) / ↑T)) loss t i * loss t i ≤ ∑ t ∈ Finset.range T, loss t j + √(2 * ↑T * Real.log ↑(Fintype.card ι))

Hedge √(2 T ln n) regret against every pure expert j : ι.

theorem Cslib.MachineLearning.OnlineLearning.OCO.entropicFTRL_regret_le_anytime {ι : Type u_1} [Fintype ι] (hn : 2 ≤ Fintype.card ι) {loss : ℕ → ι → ℝ} {T : ℕ} (hloss : ∀ t < T, ∀ (i : ι), |loss t i| ≤ 1) {u : ι → ℝ} (hu : u ∈ simplex ι) :
∑ t ∈ Finset.range T, (∑ i : ι, entropicFTRLProb (fun (t : ℕ) => √(Real.log ↑(Fintype.card ι) / (↑t + 1))) loss t i * loss t i - ∑ i : ι, u i * loss t i) ≤ 2 * √(↑T * Real.log ↑(Fintype.card ι))

Anytime 2 √(T ln n) regret for time-varying entropic FTRL: for n ≥ 2 experts and losses in [-1, 1], the horizon-independent schedule η t = √(log n / (t + 1)) guarantees regret at most 2 * √(T * log n) for every T : ℕ against every u ∈ simplex ι.