A 1-D training set has x=1 with label −1, and x=3 and x=4 with label +1. What are the hard-margin SVM w, b and the dual variables αi, and which points are support vectors?

Supervised learning, Support vectors and KKT
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can solve a tiny hard-margin SVM and read off the support vectors from the KKT conditions.

Key idea

For a hard-margin SVM, w=∑iαiyixi with αi≥0 and ∑iαiyi=0. Only points with yi(wxi+b)=1 can have αi>0.

Steps

  1. Geometry: the closest points of opposite classes are x=1 and x=3. The best boundary is halfway, at x=2, so the margin touches both of them.
  2. Impose y(wx+b)=1 on both: −(w+b)=1 and 3w+b=1. Adding gives 2w=2, so w=1 and b=−2. The margin width is 2/∣w∣=2, which matches the gap between 1 and 3.
  3. Check x=4: y(wx+b)=4−2=2>1. It is outside the margin, so by complementary slackness α4=0.
  4. Use ∑αiyi=0: −α1+α3=0, so α1=α3=a.
  5. Use w=∑αiyixi: 1=−a(1)+a(3)=2a, so a=0.5. The duals are (0.5, 0.5, 0).
  6. Support vectors are x=1 and x=3. Removing x=4 would not change the solution. As a check, the primal value 12w2=0.5 equals the dual value ∑αi−12w2=1−0.5=0.5.

Common mistakes

How long your answer should be

Half a page; 4–5 minutes.

Read this

Previous in Supervised learning: Take an orthonormal design (X⊤X=I) with noise variance σ2. For one coefficient with true value β, find the mean squared error of the ridge estimate β^/(1+λ) as a function of λ. Show that some λ>0 always beats OLS, find the best λ, and evaluate it for σ2=1, β=2. Why is this not a free lunch?
Next 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?