The SVM objective λ2∥w∥2+1n∑imax⁡(0,1−yiw⊤xi) is minimised by stochastic subgradient descent (Pegasos) with step ηt=1/(λt). With λ=0.5 and w0=0, what is the result of running three steps on the single points (x,y)=((1,2),+1), ((−1,0),−1) and ((0,−1),+1), in that order, and what is the update rule?

Supervised learning, Hinge loss and SGD
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can write the subgradient of the hinge-plus-L2 objective and apply it step by step.

Key idea

At step t with example (x,y): if y w⊤x<1, then w←(1−ηtλ)w+ηtyx. Otherwise w←(1−ηtλ)w.

Steps

  1. The subgradient of one term is λw−yx 1[y w⊤x<1]. The hinge is non-differentiable at margin 1, so we use any subgradient there. Update w←w−ηt(λw−yx 1[⋅]), which gives the rule above.
  2. t=1: η1=1/(0.5⋅1)=2. The margin is y w⊤x=0<1, so the update is active: w=(1−1)⋅0+2 (1,2)=(2,4).
  3. t=2: η2=1. The margin is −1⋅(2⋅(−1)+4⋅0)=2≥1, so only shrinkage applies: w=(1−0.5)(2,4)=(1,2).
  4. t=3: η3=2/3. The margin is +1⋅(1⋅0+2⋅(−1))=−2<1, so the update is active: w=(1−13)(1,2)+23(0,−1)=(23,43−23)=(23,23).
  5. After three steps, w=(2/3,2/3). The shrinkage factor 1−ηtλ=1−1/t comes from the L2 regulariser. Note that it is 0 at t=1, which wipes out w0.

Common mistakes

How long your answer should be

Half a page; 4–5 minutes.

Last checked on 4 December 2026.

Read this

Previous in Supervised learning: How do you derive the dual of the soft-margin SVM min⁡w,b,ξ 12∥w∥2+C∑iξi subject to yi(w⊤xi+b)≥1−ξi and ξi≥0? How do you show the box constraint 0≤αi≤C, and what are the KKT conditions that classify each point?
Next in Supervised learning: With squared loss, run two rounds of gradient boosting on x=1,2,3,4 and y=3,5,12,14, using a stump that splits between x=2 and x=3 in each round and a learning rate ν=0.5. What is the training MSE before boosting (the constant model), after round 1, and after round 2?