Documentation

CslibFrontier.MachineLearning.OnlineLearning.DynamicRegret

Dynamic regret of online gradient descent #

Extends CslibFrontier.MachineLearning.OnlineLearning.OnlineGradientDescent from a fixed comparator u ∈ K to an arbitrary sequence of comparators u : ℕ → E lying in a bounded convex set K of a real inner product space [Zinkevich2003, Hazan2022]. The path length of u over T rounds (indexed from 0) is

pathLength u T = ∑ t ∈ Finset.range (T - 1), ‖u (t + 1) - u t‖.

The dynamic regret over T rounds is ∑ t < T, (f t (x t) - f t (u t)), generalizing static regret (pathLength (fun _ => u₀) T = 0). Because ogd runs unchanged, the per-round triangle estimate ‖x - u'‖ ^ 2 - ‖x - u‖ ^ 2 ≤ 2 * D * ‖u' - u‖ combines directly with the dynamic Bregman telescoping theorems of OnlineMirrorDescent (bregman_scaled_dynamic_sum_inner_le and bregman_dynamic_regret_le) to separate the comparator drift pathLength u T from the static diameter term D.

Main definitions #

Main results #

References #

Exact section, theorem, and page locators below are unverified against primary PDFs (pending an outside-fleet source check).

Path length P_T = ∑_{t < T - 1} ‖u (t + 1) - u t‖ of a comparator sequence u : ℕ → E over T rounds indexed from 0. When T ≤ 1 or u is constant, pathLength u T = 0.

@[simp]
theorem Cslib.MachineLearning.OnlineLearning.OCO.pathLength_const {E : Type u_1} [SeminormedAddCommGroup E] (u₀ : E) (T : ℕ) :
pathLength (fun (x : ℕ) => u₀) T = 0
theorem Cslib.MachineLearning.OnlineLearning.OCO.norm_sub_sq_sub_le {E : Type u_1} [NormedAddCommGroup E] {D : ℝ} {x v w : E} (hv : ‖x - v‖ ≤ D) (hw : ‖x - w‖ ≤ D) :
‖x - w‖ ^ 2 - ‖x - v‖ ^ 2 ≤ 2 * D * ‖w - v‖

Difference of squared distances between a point x and two comparators v, w in a set of diameter at most D: ‖x - w‖ ^ 2 - ‖x - v‖ ^ 2 ≤ 2 * D * ‖w - v‖.

theorem Cslib.MachineLearning.OnlineLearning.OCO.sum_sub_le_sum_inner_dynamic {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {K : Set E} {grad : ℕ → E → E} {f : ℕ → E → ℝ} (hsub : ∀ (t : ℕ), ∀ x ∈ K, ∀ y ∈ K, f t x + inner ℝ (grad t x) (y - x) ≤ f t y) {x u : ℕ → E} (hx : ∀ (t : ℕ), x t ∈ K) (hu : ∀ (t : ℕ), u t ∈ K) (T : ℕ) :
∑ t ∈ Finset.range T, (f t (x t) - f t (u t)) ≤ ∑ t ∈ Finset.range T, inner ℝ (grad t (x t)) (x t - u t)

Subgradient linearization for dynamic regret against any comparator sequence u : ℕ → E in K: ∑ t < T, (f t (x t) - f t (u t)) ≤ ∑ t < T, ⟪grad t (x t), x t - u t⟫.

theorem Cslib.MachineLearning.OnlineLearning.OCO.ogd_dynamic_sum_inner_le {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {K : Set E} {proj : E → E} {η : ℕ → ℝ} {grad : ℕ → E → E} {x₀ : E} (hP : IsPythagoreanProjection K proj) (hx₀ : x₀ ∈ K) {D : ℝ} (hD : ∀ x ∈ K, ∀ y ∈ K, ‖x - y‖ ≤ D) (hη : ∀ (t : ℕ), 0 < η t) (hanti : Antitone η) {u : ℕ → E} (hu : ∀ (t : ℕ), u t ∈ K) (T : ℕ) :
∑ t ∈ Finset.range (T + 1), inner ℝ (grad t (ogd proj η grad x₀ t)) (ogd proj η grad x₀ t - u t) ≤ D ^ 2 / (2 * η T) + D * ∑ t ∈ Finset.range T, ‖u (t + 1) - u t‖ / η t + (∑ t ∈ Finset.range (T + 1), η t * ‖grad t (ogd proj η grad x₀ t)‖ ^ 2) / 2

Generic dynamic linearized-regret bound for ogd with positive nonincreasing step sizes on a set of diameter at most D, keeping the per-step drift weight 1 / η t.

theorem Cslib.MachineLearning.OnlineLearning.OCO.ogd_dynamic_sum_inner_le_pathLength {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {K : Set E} {proj : E → E} {η : ℕ → ℝ} {grad : ℕ → E → E} {x₀ : E} (hP : IsPythagoreanProjection K proj) (hx₀ : x₀ ∈ K) {D : ℝ} (hD : ∀ x ∈ K, ∀ y ∈ K, ‖x - y‖ ≤ D) (hη : ∀ (t : ℕ), 0 < η t) (hanti : Antitone η) {u : ℕ → E} (hu : ∀ (t : ℕ), u t ∈ K) (T : ℕ) :
∑ t ∈ Finset.range (T + 1), inner ℝ (grad t (ogd proj η grad x₀ t)) (ogd proj η grad x₀ t - u t) ≤ (D ^ 2 / 2 + D * pathLength u (T + 1)) / η T + (∑ t ∈ Finset.range (T + 1), η t * ‖grad t (ogd proj η grad x₀ t)‖ ^ 2) / 2

Bounding the weighted drift in ogd_dynamic_sum_inner_le by the terminal step size η T exposes the comparator path length pathLength u (T + 1).

theorem Cslib.MachineLearning.OnlineLearning.OCO.ogd_dynamic_sum_inner_le_of_const {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {K : Set E} {proj : E → E} {grad : ℕ → E → E} {x₀ : E} (hP : IsPythagoreanProjection K proj) (hx₀ : x₀ ∈ K) {D c : ℝ} (hD : ∀ x ∈ K, ∀ y ∈ K, ‖x - y‖ ≤ D) (hc : 0 < c) {u : ℕ → E} (hu : ∀ (t : ℕ), u t ∈ K) (T : ℕ) :
∑ t ∈ Finset.range T, inner ℝ (grad t (ogd proj (fun (x : ℕ) => c) grad x₀ t)) (ogd proj (fun (x : ℕ) => c) grad x₀ t - u t) ≤ ‖x₀ - u 0‖ ^ 2 / (2 * c) + D / c * pathLength u T + (c * ∑ t ∈ Finset.range T, ‖grad t (ogd proj (fun (x : ℕ) => c) grad x₀ t)‖ ^ 2) / 2

Dynamic linearized regret for ogd with a constant step size c > 0, keeping the exact initial distance ‖x₀ - u 0‖ ^ 2 / (2 * c) plus the comparator drift term D / c * pathLength u T.

theorem Cslib.MachineLearning.OnlineLearning.OCO.ogd_dynamic_regret_le_fixed {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {K : Set E} {proj : E → E} {grad : ℕ → E → E} {x₀ : E} {f : ℕ → E → ℝ} (hP : IsPythagoreanProjection K proj) (hx₀ : x₀ ∈ K) {D G : ℝ} (hD0 : 0 < D) (hG0 : 0 < G) (hD : ∀ x ∈ K, ∀ y ∈ K, ‖x - y‖ ≤ D) (hG : ∀ (t : ℕ), ∀ x ∈ K, ‖grad t x‖ ≤ G) (hsub : ∀ (t : ℕ), ∀ x ∈ K, ∀ y ∈ K, f t x + inner ℝ (grad t x) (y - x) ≤ f t y) {u : ℕ → E} (hu : ∀ (t : ℕ), u t ∈ K) {T : ℕ} (hT : 0 < T) :
∑ t ∈ Finset.range T, (f t (ogd proj (fun (x : ℕ) => D / (G * √↑T)) grad x₀ t) - f t (u t)) ≤ G * (D + pathLength u T) * √↑T

Dynamic regret of OGD with standard fixed step size η = D / (G * √T): for a diameter-D set and G-bounded subgradients, dynamic regret over T ≥ 1 rounds against any comparator sequence u in K is at most G * (D + pathLength u T) * √T. When u is constant (pathLength u T = 0), this matches ogd_regret_le_fixed.

theorem Cslib.MachineLearning.OnlineLearning.OCO.ogd_dynamic_regret_le_tuned {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {K : Set E} {proj : E → E} {grad : ℕ → E → E} {x₀ : E} {f : ℕ → E → ℝ} (hP : IsPythagoreanProjection K proj) (hx₀ : x₀ ∈ K) {D G P : ℝ} (hD0 : 0 < D) (hG0 : 0 < G) (hD : ∀ x ∈ K, ∀ y ∈ K, ‖x - y‖ ≤ D) (hG : ∀ (t : ℕ), ∀ x ∈ K, ‖grad t x‖ ≤ G) (hsub : ∀ (t : ℕ), ∀ x ∈ K, ∀ y ∈ K, f t x + inner ℝ (grad t x) (y - x) ≤ f t y) {u : ℕ → E} (hu : ∀ (t : ℕ), u t ∈ K) {T : ℕ} (hT : 0 < T) (hpath : pathLength u T ≤ P) :
∑ t ∈ Finset.range T, (f t (ogd proj (fun (x : ℕ) => √(D ^ 2 + 2 * D * P) / (G * √↑T)) grad x₀ t) - f t (u t)) ≤ G * √(↑T * (D ^ 2 + 2 * D * P))

Optimal path-length-tuned dynamic regret of OGD [Zin03] (locator unverified): when an upper bound P ≥ pathLength u T is used to tune the constant step size η = √(D ^ 2 + 2 * D * P) / (G * √T), the dynamic regret over T ≥ 1 rounds is at most G * √(T * (D ^ 2 + 2 * D * P)).

theorem Cslib.MachineLearning.OnlineLearning.OCO.ogd_dynamic_sum_inner_le_sqrt {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {K : Set E} {proj : E → E} {grad : ℕ → E → E} {x₀ : E} (hP : IsPythagoreanProjection K proj) (hx₀ : x₀ ∈ K) {D G c : ℝ} (hD : ∀ x ∈ K, ∀ y ∈ K, ‖x - y‖ ≤ D) (hG : ∀ (t : ℕ), ∀ x ∈ K, ‖grad t x‖ ≤ G) (hc : 0 < c) {u : ℕ → E} (hu : ∀ (t : ℕ), u t ∈ K) (T : ℕ) :
∑ t ∈ Finset.range (T + 1), inner ℝ (grad t (ogd proj (fun (t : ℕ) => c / √(↑t + 1)) grad x₀ t)) (ogd proj (fun (t : ℕ) => c / √(↑t + 1)) grad x₀ t - u t) ≤ (D ^ 2 / 2 + D * pathLength u (T + 1)) / c * √(↑T + 1) + c * G ^ 2 * (√(↑T + 1) - 1 / 2)

Linearized dynamic regret with step sizes c / √(t + 1) over T + 1 rounds.

theorem Cslib.MachineLearning.OnlineLearning.OCO.ogd_dynamic_regret_le_three_halves {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {K : Set E} {proj : E → E} {grad : ℕ → E → E} {x₀ : E} {f : ℕ → E → ℝ} (hP : IsPythagoreanProjection K proj) (hx₀ : x₀ ∈ K) {D G : ℝ} (hD0 : 0 < D) (hG0 : 0 < G) (hD : ∀ x ∈ K, ∀ y ∈ K, ‖x - y‖ ≤ D) (hG : ∀ (t : ℕ), ∀ x ∈ K, ‖grad t x‖ ≤ G) (hsub : ∀ (t : ℕ), ∀ x ∈ K, ∀ y ∈ K, f t x + inner ℝ (grad t x) (y - x) ≤ f t y) {u : ℕ → E} (hu : ∀ (t : ℕ), u t ∈ K) (T : ℕ) :
∑ t ∈ Finset.range T, (f t (ogd proj (fun (t : ℕ) => D / (G * √(↑t + 1))) grad x₀ t) - f t (u t)) ≤ (3 / 2 * D + pathLength u T) * G * √↑T

Horizon-independent dynamic regret of OGD: with step sizes D / (G * √(t + 1)), the dynamic regret after T rounds is at most (3 / 2 * D + pathLength u T) * G * √T, extending ogd_regret_le_three_halves to any moving comparator sequence u in K.

theorem Cslib.MachineLearning.OnlineLearning.OCO.ogd_dynamic_regret_le_zinkevich {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {K : Set E} {proj : E → E} {grad : ℕ → E → E} {x₀ : E} {f : ℕ → E → ℝ} (hP : IsPythagoreanProjection K proj) (hx₀ : x₀ ∈ K) {D G : ℝ} (hD : ∀ x ∈ K, ∀ y ∈ K, ‖x - y‖ ≤ D) (hG : ∀ (t : ℕ), ∀ x ∈ K, ‖grad t x‖ ≤ G) (hsub : ∀ (t : ℕ), ∀ x ∈ K, ∀ y ∈ K, f t x + inner ℝ (grad t x) (y - x) ≤ f t y) {u : ℕ → E} (hu : ∀ (t : ℕ), u t ∈ K) {T : ℕ} (hT : 0 < T) :
∑ t ∈ Finset.range T, (f t (ogd proj (fun (t : ℕ) => 1 / √(↑t + 1)) grad x₀ t) - f t (u t)) ≤ (D ^ 2 / 2 + D * pathLength u T) * √↑T + (√↑T - 1 / 2) * G ^ 2

Dynamic regret under Zinkevich's 1 / √(t + 1) schedule [Zin03] (locator unverified): for T ≥ 1, dynamic regret after T rounds is at most (D ^ 2 / 2 + D * pathLength u T) * √T + (√T - 1 / 2) * G ^ 2.