How do you derive the hard-margin SVM objective, and why is the margin , where 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 , where is the bias. The distance from a point to it is . Because can be rescaled freely without moving the hyperplane, fix the scale so the closest points satisfy .
Steps
- Write the hyperplane and the point-to-plane distance.
- Use the canonical scaling, so the margin is on each side and in total.
- Maximising is the same as minimising , which is easier because it is smooth and convex: Here is the label of , and each constraint keeps that point on its correct side, outside the margin.
- 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 , so the optimal is unique. If the data are not separable, no satisfies the constraints and the problem has no solution.
- Mention the dual problem. Only the support vectors (the points on the margin) have , where are the Lagrange multipliers. The data enter only through inner products , which is what makes kernels possible.
Common mistakes
- Forgetting that is scale-invariant, which is why the canonical scaling is allowed.
- Confusing the half-margin with the full margin .
- Applying the hard-margin form to non-separable data. That needs slack variables, which allow some points inside the margin (the soft margin).
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: and . Ridge adds the penalty and lasso adds , with . 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 singular, what do you do then, and what is a concrete example of a singular design?