Online gradient descent #
In online convex optimization [Zinkevich2003, Hazan2022] a learner repeatedly plays a point
x t of a convex set K in a real inner product space, after which an adversary reveals a convex
loss f t : E → ℝ. The regret against a comparator u ∈ K after T rounds is
∑ t < T, (f t (x t) - f t u). Online gradient descent (ogd) [Hazan2022, Algorithm 8] (the
greedy projection algorithm of [Zinkevich2003, Algorithm 1]) steps against a subgradient and
projects back onto K:
x 0 = x₀, x (t + 1) = Π_K (x t - η t • grad t (x t)).
Rounds are indexed from 0, so the step size η t here is the source's η_{t+1}. The
subgradient oracle grad : ℕ → E → E is an arbitrary function of the round and the query point,
and the losses f t are arbitrary. Since OGD is deterministic, an adversary that adapts to the
learner's past points selects nothing it could not have fixed in advance, so these bounds cover
adaptive adversaries. Every bound holds for each comparator u ∈ K; taking the maximum over
u gives the regret Regret_T of [Hazan2022, §3.1].
The projection is any map proj satisfying the Pythagorean inequality
‖proj y - z‖ ≤ ‖y - z‖ for z ∈ K and landing in K (IsPythagoreanProjection). The metric
projection onto a nonempty complete convex set is one
(isPythagoreanProjection_metricProjection, [Hazan2022, Theorem 2.1]). Every Pythagorean
projection step satisfies the Euclidean Bregman descent inequality (projected_step_bregman_le),
so all static, horizon-independent, and strongly convex logarithmic regret bounds below are
derived from the master adaptive OMD telescoping theorems in
CslibFrontier.MachineLearning.OnlineLearning.OnlineMirrorDescent. The losses enter through
the subgradient inequality f t x + ⟪grad t x, y - x⟫ ≤ f t y for x y ∈ K, the definition of
convexity with subgradients in [Hazan2022, §2.1]. For differentiable convex losses with
gradients it follows from ConvexOn.add_inner_le_of_hasGradientAt. The strongly convex form
f t x + ⟪grad t x, y - x⟫ + α / 2 * ‖y - x‖ ^ 2 ≤ f t y follows likewise from
StrongConvexOn.add_inner_add_le_of_hasGradientAt (or the HasGradientWithinAt variants,
which allow boundary points). D bounds the diameter of K and G the subgradient norms on
K.
Main definitions #
Cslib.MachineLearning.OnlineLearning.OCO.IsPythagoreanProjection: maps intoKsatisfying the Pythagorean inequality.Cslib.MachineLearning.OnlineLearning.OCO.ogd: the iterates of online gradient descent.
Main results #
Cslib.MachineLearning.OnlineLearning.OCO.projected_step_bregman_le,Cslib.MachineLearning.OnlineLearning.OCO.ogd_step_bregman_le: Euclidean Bregman descent bridges for Pythagorean projection andogdsteps (including zero-weight skip rounds).Cslib.MachineLearning.OnlineLearning.OCO.ogd_sum_inner_le: for nonincreasing positive step sizes,∑ t ≤ T, ⟪grad t (x t), x t - u⟫ ≤ D ^ 2 / (2 η T) + ∑ t ≤ T, η t ‖grad t (x t)‖ ^ 2 / 2.Cslib.MachineLearning.OnlineLearning.OCO.ogd_sum_inner_le_of_const: for a constant step sizec, the same with‖x₀ - u‖ ^ 2 / (2 c)in place ofD ^ 2 / (2 η T).Cslib.MachineLearning.OnlineLearning.OCO.norm_ogd_sub_le:‖x t - x₀‖ ≤ G * ∑ s < t, η s.Cslib.MachineLearning.OnlineLearning.OCO.ogd_regret_le_three_halves: with step sizesD / (G √(t + 1)), regret at most3 / 2 * G * D * √T[Hazan2022, Theorem 3.1].Cslib.MachineLearning.OnlineLearning.OCO.ogd_regret_le_zinkevich: with step sizes1 / √(t + 1), regret at mostD ^ 2 √T / 2 + (√T - 1 / 2) G ^ 2[Zinkevich2003, Theorem 1].Cslib.MachineLearning.OnlineLearning.OCO.ogd_regret_le_fixed: with the constant step sizeD / (G √T)for a known horizonT, regret at mostG * D * √T.Cslib.MachineLearning.OnlineLearning.OCO.ogd_regret_le_fixed_of_norm_sub_leneeds only‖x₀ - u‖ ≤ Binstead of a diameter bound, and givesG * B * √Twith step sizeB / (G √T).Cslib.MachineLearning.OnlineLearning.OCO.ogd_regret_le_log: forα-strongly convex losses and step sizes1 / (α (t + 1)), regret at mostG ^ 2 / (2 α) * (1 + log T)[Hazan2022, Theorem 3.3].Cslib.MachineLearning.OnlineLearning.OCO.norm_sub_le_of_strongConvex: the strongly convex hypotheses forcediam K ≤ 2 G / α.
References #
proj maps into K and satisfies the Pythagorean inequality ‖proj y - z‖ ≤ ‖y - z‖ for
every z ∈ K, the only properties of the projection used by online gradient descent.
- mem (y : E) : proj y ∈ K
The metric projection onto a nonempty complete convex set satisfies the Pythagorean inequality [Hazan2022, Theorem 2.1].
Unconstrained gradient descent: the identity is a Pythagorean projection onto the whole
space. Since Set.univ has no finite diameter (unless E is trivial), and the strongly convex
hypotheses force a finite diameter (norm_sub_le_of_strongConvex), the bounds that apply to it
nontrivially are those that use only ‖x₀ - u‖: ogd_two_mul_inner_le,
ogd_sum_inner_le_of_const and ogd_regret_le_fixed_of_norm_sub_le.
The iterates of online gradient descent [Hazan2022, Algorithm 8] with projection proj, step
sizes η, subgradient oracle grad and starting point x₀:
x (t + 1) = proj (x t - η t • grad t (x t)).
Each step of online gradient descent moves at most η t * G when the subgradients on K have
norm at most G, so ‖x t - x₀‖ ≤ G * ∑ s < t, η s.
A Pythagorean projection step x' = proj (x - (1 / w) • g) (w ≥ 0, with g = 0 when
w = 0) satisfies the Euclidean Bregman descent inequality for the scaled generator
ψ z = w * (‖z‖ ^ 2 / 2).
One projected gradient step decreases the squared distance to a feasible comparator, up to the inner-product loss and the squared step length.
One step of ogd satisfies the scaled Euclidean Bregman descent inequality for
ψ z = (1 / η t) * (‖z‖ ^ 2 / 2).
One step of online gradient descent against a comparator u ∈ K:
2 ⟪g, x t - u⟫ ≤ (‖x t - u‖ ^ 2 - ‖x (t + 1) - u‖ ^ 2) / η t + η t ‖g‖ ^ 2 with
g = grad t (x t) [Hazan2022, proof of Theorem 3.1].
The generic bound for online gradient descent with positive nonincreasing step sizes on a set
of diameter at most D: against every u ∈ K,
∑ t ≤ T, ⟪grad t (x t), x t - u⟫ ≤ D ^ 2 / (2 η T) + (∑ t ≤ T, η t ‖grad t (x t)‖ ^ 2) / 2
[Hazan2022, proof of Theorem 3.1].
Online gradient descent with a constant step size c > 0: against every u ∈ K,
∑ t < T, ⟪grad t (x t), x t - u⟫ ≤ ‖x₀ - u‖ ^ 2 / (2 c) + c (∑ t < T, ‖grad t (x t)‖ ^ 2) / 2.
Only the distance from the starting point to the comparator enters, not the diameter of K.
Regret through subgradients: for any points x t ∈ K and any u ∈ K, the subgradient
inequality bounds ∑ t < T, (f t (x t) - f t u) by ∑ t < T, ⟪grad t (x t), x t - u⟫.
Online gradient descent with step sizes c / √(t + 1): the linearized regret over T + 1
rounds is at most D ^ 2 / (2 c) √(T + 1) + c G ^ 2 (√(T + 1) - 1 / 2).
Regret of online gradient descent [Hazan2022, Theorem 3.1]: for losses satisfying the
subgradient inequality with subgradients of norm at most G on a set of diameter at most D, the
step sizes D / (G √(t + 1)) give regret at most 3 / 2 * G * D * √T against every u ∈ K.
Zinkevich's regret bound [Zinkevich2003, Theorem 1]: with step sizes 1 / √(t + 1), the
regret after T ≥ 1 rounds is at most D ^ 2 √T / 2 + (√T - 1 / 2) G ^ 2.
Fixed step size, from the distance to the comparator: for a known horizon T ≥ 1 and a
comparator u ∈ K with ‖x₀ - u‖ ≤ B, the constant step size B / (G √T) gives regret at most
G * B * √T against u. No bound on the diameter of K is needed, so K may be the whole space;
this is the regret bound behind [ShalevShwartzBenDavid2014, Theorem 14.8].
Fixed step size: for a known horizon T ≥ 1, the constant step size D / (G √T) gives
regret at most G * D * √T.
The strongly convex hypotheses bound the diameter: if f satisfies
f x + ⟪g x, y - x⟫ + α / 2 * ‖y - x‖ ^ 2 ≤ f y on K with α > 0 and ‖g x‖ ≤ G on K,
then ‖x - y‖ ≤ 2 G / α for x y ∈ K.
Logarithmic regret for strongly convex losses [Hazan2022, Theorem 3.3]: if every loss
satisfies f t x + ⟪grad t x, y - x⟫ + α / 2 * ‖y - x‖ ^ 2 ≤ f t y on K with α > 0 and the
subgradients have norm at most G on K, the step sizes 1 / (α (t + 1)) give regret at most
G ^ 2 / (2 α) * (1 + log T) against every u ∈ K. No separate diameter hypothesis is assumed
(these hypotheses already force ‖x - y‖ ≤ 2 G / α on K, norm_sub_le_of_strongConvex).