What is the subgradient of the hinge loss, and why is it zero for correctly classified points outside the margin?
Quick Overview
Asks for the subgradient of the SVM hinge loss and why points beyond the margin give a zero subgradient. Tests piecewise differentiation, the subdifferential at the kink, the link to support vectors and dual variables, and how the regularizer changes the update.
What is the subgradient of the hinge loss, and why is it zero for correctly classified points outside the margin?
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: medium
Interview Round: Other
What is the subgradient of the hinge loss, and why is it zero for correctly classified points outside the margin? Use the loss $L(w) = \max(0, 1 - y\, w^\top x)$ for a single example with label $y \in \{-1, +1\}$.
```hint Split on the margin
Write the loss as a function of the margin $m = y\, w^\top x$ and handle each linear piece separately, including the point where the two pieces meet.
```
### What a Strong Answer Covers
- The subgradient in each region of the margin, including the full subdifferential at the kink
- Why points beyond the margin contribute nothing to the update, stated in terms of how the loss behaves near the current $w$
- The link between these points and the support vectors, or the zero dual variables
- What changes once the $L_2$ regularizer is added to the objective
### Follow-up Questions
- A point is classified correctly with margin 0.4. Does it still move the weights? Why?
- How does the perceptron's update differ from the hinge-loss update, and what does the margin requirement add?
- Why can subgradient descent on the SVM objective converge more slowly than gradient descent on a smooth loss, and what step-size schedule is usually used?
- How would the squared hinge loss change the subgradient and the set of points that affect training?
Overview: Asks for the subgradient of the SVM hinge loss and why points beyond the margin give a zero subgradient. Tests piecewise differentiation, the subdifferential at the kink, the link to support vectors and dual variables, and how the regularizer changes the update.
What is the subgradient of the hinge loss, and why is it zero for correctly classified points outside the margin? Use the loss L(w)=max(0,1−yw⊤x) for a single example with label y∈{−1,+1}.
What a Strong Answer Covers Guidance
The subgradient in each region of the margin, including the full subdifferential at the kink
Why points beyond the margin contribute nothing to the update, stated in terms of how the loss behaves near the current
w
The link between these points and the support vectors, or the zero dual variables
What changes once the
L2
regularizer is added to the objective
Follow-up Questions Guidance
A point is classified correctly with margin 0.4. Does it still move the weights? Why?
How does the perceptron's update differ from the hinge-loss update, and what does the margin requirement add?
Why can subgradient descent on the SVM objective converge more slowly than gradient descent on a smooth loss, and what step-size schedule is usually used?
How would the squared hinge loss change the subgradient and the set of points that affect training?