Concepts / Online Gradient Descent

Online Gradient Descent

The Perceptron can be placed inside the Online Gradient Descent framework.

  • Programming

The Online Learning Loop

Online Gradient Descent is a repeated prediction-and-update process for online convex learning problems. At the beginning of round t, the learner has a current hypothesis w(t) and uses it to make a prediction. The learner then receives the round's data item, forms a loss function for that round, selects a subgradient, and updates the hypothesis before the next round.

then receiveconstructsdeterminesdrivesPredictionw(t)Data item z(t)received afterwardLoss f(t)round-specificSubgradient v(t)from f(t)Hypothesis updatew(t+1)
How do prediction, round-specific loss, subgradient, and hypothesis update occur in sequence during one iteration?

Initialization and Update

Online Gradient Descent starts with the zero hypothesis, w(1) = 0. For a sequence of round-specific functions f₁ through fᵀ, the general update is w(t+1) = w(t) − ηvₜ, where η is positive and vₜ is the subgradient selected for round t. In the Perceptron analysis, the hypothesis class is all vectors in Rᵈ, so the projection step is vacuous.

w(1) = 0
w(t+1) = w(t) − ηvₜ

The Perceptron update has the form w(t+1) = w(t) − vₜ. The source explains that this is equivalent to the Online Gradient Descent form for every η greater than zero. This equivalence lets the Online Gradient Descent theorem be used in the Perceptron analysis.

From Loss to Perceptron Update

The Perceptron is analyzed by selecting a surrogate loss function for the current online round and then using its subgradient in the update. The selected subgradient is vₜ = −1[yₜ⟨w(t), xₜ⟩ ≤ 0] yₜxₜ. The indicator is active when the current example satisfies yₜ⟨w(t), xₜ⟩ ≤ 0, so the subgradient contains the labeled example direction yₜxₜ on that condition. Substituting this subgradient into w(t+1) = w(t) − vₜ gives the Perceptron update.

vₜ = −1[yₜ⟨w(t), xₜ⟩ ≤ 0] yₜxₜ

w(t+1) = w(t) − vₜ

evaluatetestselectsubtractw(t), x(t), y(t)current hypothesis andexampley(t)⟨w(t), x(t)⟩current evaluationMargin condition≤ 0v(t)−1[condition]y(t)x(t)w(t+1)w(t) − v(t)
How does the loss incurred on a particular example produce the Perceptron subgradient and determine the direction and size of the update?

Correct Rounds and Convexity

Convexity matters because the Perceptron is being analyzed through Online Gradient Descent. On a round where the Perceptron is correct, the selected surrogate loss fₜ is convex and evaluates to zero at the current hypothesis: fₜ(w(t)) = ℓ(w(t), (xₜ, yₜ)) = 0. Thus, the correct-round case supplies a convex surrogate whose value at the current hypothesis is zero.

evaluates atequalsf(t)convex surrogatef(t)(w(t))round value0correct-round value
Why does convexity combine with a zero current loss on a correct round in the Perceptron analysis?

Two Update Steps

The algorithm's two update expressions should be read separately. First, the current hypothesis and the selected subgradient produce an intermediate Online Gradient Descent update, w(t+1) = w(t) − ηvₜ. Second, the algorithm performs the stated selection over the hypothesis class H for the next-round choice. In the Perceptron analysis, H consists of all vectors in Rᵈ, so the projection step is vacuous. The first step changes the current vector using the round's subgradient; the second describes how the next hypothesis is selected within H.

subtract ηv(t)select withinconstrainsw(t)current hypothesisw(t) − ηv(t)intermediate updatew(t+1)next-round hypothesisHhypothesis class
What changes in the intermediate hypothesis and in the next-round hypothesis at each of the algorithm's two update steps?

Symbolic Round Trace

One Symbolic Iteration

Trace one round of Online Gradient Descent when the learner begins with w(t), receives z(t), and obtains subgradient v(t).

Prediction: Use the hypothesis available at the start of the round, w(t), to make the prediction.

Receive data: After the prediction, receive the round's data item z(t).

Form the loss: Use z(t) to construct the loss function for the current round, f(t).

Select a subgradient: Obtain the current subgradient v(t) from the round-specific loss.

Intermediate update: Apply the Online Gradient Descent update w(t) − ηv(t).

Select over H: Use the algorithm's second update step to select the next hypothesis over H.

The dependency order is prediction, data receipt, loss formation, subgradient selection, intermediate update, and selection over H.

usesfollowed bydrivesproducesCurrent hypothesisw(t)Predictionbefore z(t)Example z(t)received after predictionAdaptationloss and subgradientNext hypothesisw(t+1)
How does Online Gradient Descent receive an example, make a prediction, observe the outcome, and adapt its hypothesis before the next round?

Regret Against H

Online Gradient Descent is designed to solve online convex learning problems while adapting after each round. Its theoretical guarantee is stated as a regret bound that holds for every w⋆ in H. The important quantifier is every: the statement is not limited to one specially chosen competitor. It provides a comparison guarantee for each fixed competing hypothesis in the hypothesis class.

compared throughfor everyOnline GradientDescentcumulative lossw⋆any member of HRegret boundholds for every w⋆ in H
How does the cumulative loss of Online Gradient Descent compare with the cumulative loss associated with any fixed competing hypothesis in H over many rounds?

Common Tracing Mistakes

  • Using the newly received example to define the prediction that was already made.

    The prediction uses the value available at the start of the round. The data item is received afterward.

    Fix: Write the order as prediction, data receipt, loss formation, subgradient selection, and update.

  • Using one identical surrogate loss for every online round.

    The online analysis permits a round-specific surrogate loss fₜ.

    Fix: Index the current loss by t and construct it from the current round's data.

  • Leaving the Perceptron subgradient separate from Online Gradient Descent.

    The subgradient is the quantity used in the Online Gradient Descent update.

    Fix: Substitute vₜ into w(t+1) = w(t) − vₜ to see the Perceptron form.

  • Treating the two update steps as one unexplained operation.

    The source emphasizes that the two update expressions must be traced separately.

    Fix: First apply the subgradient update, then account for selection over the hypothesis class.

Practice Trace

MEDIUM

Write the six stages of one symbolic Online Gradient Descent round in order. Include the current hypothesis, the received data item, the round-specific loss, the selected subgradient, the intermediate update, and the selection over H.

Hints
  • The prediction happens before the data item is received.
  • The current loss is constructed from the current round's data.
  • The subgradient is used before the next-round hypothesis is selected.
MEDIUM

Explain in words why the Perceptron can be analyzed with an Online Gradient Descent theorem even though its update is written as w(t+1) = w(t) − vₜ.

Hints
  • Compare the Perceptron update with the general update w(t+1) = w(t) − ηvₜ.
  • Use the source's statement about every positive η.

Key Takeaways

  1. Online Gradient Descent repeatedly predicts, receives data, forms a round-specific loss, selects a subgradient, and updates its hypothesis.
  2. It starts with w(1) = 0 and uses the general update w(t+1) = w(t) − ηvₜ.
  3. The Perceptron subgradient is vₜ = −1[yₜ⟨w(t), xₜ⟩ ≤ 0] yₜxₜ, producing the Perceptron update w(t+1) = w(t) − vₜ.
  4. On correct rounds, the selected surrogate loss is convex and has value zero at the current hypothesis.
  5. The regret guarantee is stated for every competing hypothesis w⋆ in H.

Key Takeaways

  • Online Gradient Descent is a framework for repeated prediction and adaptation in online convex learning.
  • The Perceptron fits the framework through a round-specific surrogate loss and its corresponding subgradient.
  • The correct procedural order is prediction, data receipt, loss formation, subgradient selection, intermediate update, and selection over H.
  • Convexity and zero loss on correct rounds support the Perceptron analysis.
  • The regret statement applies to every fixed competitor in the hypothesis class H.