How do you derive the hard-margin SVM objective, and why is the margin 2∥w∥, where w is the weight vector?

Supervised learning, Support vector machines
Level L3 Intermediate. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can turn a geometric idea (the widest street separating the two classes) into a convex optimisation problem.

Key idea

The separating hyperplane is w⊤x+b=0, where b is the bias. The distance from a point x to it is ∣w⊤x+b∣/∥w∥. Because (w,b) can be rescaled freely without moving the hyperplane, fix the scale so the closest points satisfy ∣w⊤x+b∣=1.

Steps

  1. Write the hyperplane and the point-to-plane distance.
  2. Use the canonical scaling, so the margin is 1/∥w∥ on each side and 2/∥w∥ in total.
  3. Maximising 2/∥w∥ is the same as minimising 12∥w∥2, which is easier because it is smooth and convex: min⁡w,b 12∥w∥2s.t.yi(w⊤xi+b)≥1  ∀i. Here yi∈{−1,+1} is the label of xi, and each constraint keeps that point on its correct side, outside the margin.
  4. Note that this is a convex quadratic program. If the data are linearly separable, the constraints can be met, so there is a global optimum and no bad local minima; the objective is strictly convex in w, so the optimal w is unique. If the data are not separable, no (w,b) satisfies the constraints and the problem has no solution.
  5. Mention the dual problem. Only the support vectors (the points on the margin) have αi>0, where αi are the Lagrange multipliers. The data enter only through inner products xi⊤xj, which is what makes kernels possible.

Common mistakes

How long your answer should be

A 5–10 minute whiteboard derivation.

Read this

Previous in Supervised learning: Two weight vectors fit a training set equally well: wA=(3,0) and wB=(1.5,1.5). Ridge adds the penalty λ∑jwj2 and lasso adds λ∑j∣wj∣, with λ=0.1. Compute both penalties for each vector. Which vector does each method prefer?
Next in Supervised learning: How do you derive the normal equations for least-squares linear regression? When is X⊤X singular, what do you do then, and what is a concrete example of a singular design?