Surrogate Loss Functions
The natural loss may express the learning goal directly, but natural loss functions are often not convex.
From Natural Loss to Surrogate
A learning algorithm needs a loss function to judge predictions. The natural loss may express the learning goal directly, but natural loss functions are often not convex. This creates a central difficulty: when the loss is non-convex, implementing the empirical risk minimization rule is hard. Surrogate loss functions are introduced to provide a loss-based analysis with useful convex structure. The Perceptron is a central example because its mistake-driven update can be viewed as an instance of Online Gradient Descent.
| Learning view | Role in the analysis |
|---|---|
| Natural loss | Expresses the learning goal, but may be non-convex |
| 0-1 loss | A natural, non-convex loss function |
| Surrogate loss | Provides a loss used to connect the learning problem to convex analysis |
| Online Gradient Descent | Uses a round-specific subgradient to update the current hypothesis |
The surrogate-loss approach separates the natural learning goal from the convex structure used for analysis.
Online Gradient Descent State
Online Gradient Descent begins with the hypothesis w(1) = 0. At round t, the algorithm has a current hypothesis w(t), observes the current example xₜ and its label yₜ, obtains a subgradient vₜ for the round-specific loss, and forms the next hypothesis with w(t+1) = w(t) − ηvₜ. In the Perceptron analysis, the hypothesis class is all vectors in Rᵈ, so the projection step is vacuous. The Perceptron update is written without a learning-rate factor as w(t+1) = w(t) − vₜ, and the source explains that this is equivalent to the Online Gradient Descent form for every η > 0.
- 1Initialize the first hypothesis at the zero vector.
- 2At round t, use the subgradient vₜ associated with the current example and the current hypothesis.
- 3Scale the subgradient by η and subtract it from the current hypothesis.
- 4For the Perceptron analysis, the update is written as w(t+1) = w(t) − vₜ.
The Perceptron Subgradient
- 1Evaluate the current signed score yₜ⟨w(t), xₜ⟩.
- 2The indicator 1[yₜ⟨w(t), xₜ⟩ ≤ 0] selects the update condition used in the Perceptron analysis.
- 3When the condition is selected, vₜ is −yₜxₜ.
- 4Subtracting vₜ gives the Perceptron update w(t+1) = w(t) − vₜ.
- 5When the condition is not selected, the indicator makes vₜ equal to zero, so the hypothesis is left unchanged for that round.
Tracing One Selected Update
Suppose a round satisfies the Perceptron condition yₜ⟨w(t), xₜ⟩ ≤ 0. What subgradient and next hypothesis does the stated rule produce?
- 1Select the indicator
Because the condition yₜ⟨w(t), xₜ⟩ ≤ 0 holds, the indicator in vₜ = −1[yₜ⟨w(t), xₜ⟩ ≤ 0]yₜxₜ selects the value 1.
- 2Evaluate the subgradient
The subgradient becomes vₜ = −yₜxₜ.
- 3Apply the update
Substituting this subgradient into w(t+1) = w(t) − vₜ gives the Perceptron update.
The round produces vₜ = −yₜxₜ and updates the hypothesis by w(t+1) = w(t) − vₜ.
Correct Rounds and Convexity
The surrogate loss used in the analysis is allowed to vary from one online round to another. On a round where the Perceptron is correct, the selected loss fₜ is defined to be convex and evaluates to zero at the current hypothesis: fₜ(w(t)) = ℓ(w(t), (xₜ, yₜ)) = 0. This matters because the Perceptron is being analyzed through Online Gradient Descent, a framework that uses subgradients of the round-specific losses. The correct-round case therefore supplies a convex surrogate with zero value at the current hypothesis.
Why Direct ERM Is Difficult
The source uses halfspaces as a hypothesis class for illustrating the difficulty of learning with a natural non-convex loss. The 0-1 loss is natural, but it is non-convex. Consequently, directly implementing the ERM rule is hard in this setting. The surrogate-loss approach changes the analysis: instead of relying only on the difficult natural loss, it introduces losses with convex structure so that an Online Gradient Descent analysis can be applied.
Common mistake Treating the 0-1 loss as convex because it is a natural way to judge prediction errors.
What it looks likeCalling 0-1 loss the optimization-friendly loss for the halfspace learning problem.
Why it failsThe source identifies 0-1 loss as a natural, non-convex loss function.
Do this insteadSeparate the natural loss from the surrogate loss introduced for convex analysis.
Common mistake Assuming that the same surrogate loss must be used on every online round.
What it looks likeDescribing the Perceptron analysis as if one fixed function were applied to every example.
Why it failsThe online analysis permits a round-specific choice of fₜ.
Do this insteadAt round t, identify the current loss fₜ and use its corresponding subgradient.
Common mistake Forgetting the initialization of Online Gradient Descent.
What it looks likeStarting the update from an unspecified or previously chosen hypothesis.
Why it failsThe stated Online Gradient Descent procedure starts with w(1) = 0.
Do this insteadBegin the sequence with the zero vector and then apply the round updates.
Practice the Update Chain
Explain the Perceptron analysis in four linked steps: identify the current hypothesis and labeled example, state the subgradient vₜ, write the next-hypothesis rule, and explain why a surrogate loss is used instead of relying directly on the natural 0-1 loss.
Hints
- Start with w(1) = 0 when describing Online Gradient Descent.
- Use vₜ = −1[yₜ⟨w(t), xₜ⟩ ≤ 0]yₜxₜ.
- Connect w(t+1) = w(t) − vₜ to the general Online Gradient Descent rule.
- Mention non-convexity and the difficulty of implementing ERM.
What do you think happens?
If the indicator condition in vₜ = −1[yₜ⟨w(t), xₜ⟩ ≤ 0]yₜxₜ is not selected on a round, what happens to the hypothesis?
Reveal answer
The subgradient is zero, so the hypothesis is left unchanged
When the indicator is not selected, vₜ = 0. Substituting into w(t+1) = w(t) − vₜ leaves w(t+1) equal to w(t) for that round.
Key Takeaways
- 1The Perceptron can be analyzed as Online Gradient Descent using a surrogate loss selected for each online round.
- 2Online Gradient Descent starts with w(1) = 0 and updates with w(t+1) = w(t) − ηvₜ.
- 3The Perceptron subgradient is vₜ = −1[yₜ⟨w(t), xₜ⟩ ≤ 0]yₜxₜ, and its update is w(t+1) = w(t) − vₜ.
- 4On correct rounds, the selected loss is convex and has value zero at the current hypothesis.
- 5The 0-1 loss is natural but non-convex, making direct ERM difficult; surrogate losses provide the convex structure used for efficient analysis.
At a glance
- Surrogate losses connect the Perceptron's mistake-driven behavior to Online Gradient Descent.
- The online analysis may choose a different loss fₜ for each round.
- The Perceptron update follows from the subgradient vₜ = −1[yₜ⟨w(t), xₜ⟩ ≤ 0]yₜxₜ.
- Convexity is useful because convex problems can be learned efficiently, while direct ERM for non-convex losses is difficult.
- The natural 0-1 loss motivates introducing a convex surrogate for analysis.