TARGET DECK MachineLearning::Week-05
Soft-Margin SVM
Why do we need a soft-margin SVM?
The hard-margin constraint for all requires every point to be correctly classified beyond the margin. If even one point can’t satisfy that — because classes overlap, or noise has shifted a point to the wrong side — the constraint set is empty and there’s no solution. Real data usually has overlap or label noise, so hard-margin is too brittle.
Write the soft-margin SVM primal problem.
Each training example gets a personal violation budget . The hyperparameter trades margin width against violation tolerance.
What is a slack variable , and how does its value encode a point's position?
is the per-example margin-violation budget. At the optimum, — exactly the hinge loss. Position by value:
- : outside or on the margin envelope
- : inside the margin, correctly classified
- : exactly on the decision boundary
- : misclassified — wrong side of the boundary
What does the hyperparameter control in soft-margin SVM, and what happens at the extremes?
sets the price of slack:
- Large : slack is expensive → narrow margin, behaves like hard-margin (many SVs, risk of overfitting).
- Small : slack is cheap → wide margin, many margin-violators tolerated (risk of underfitting; in extreme case, model collapses to “always predict majority class”).
is the bias-variance trade-off knob, typically chosen by cross-validation.
What is the soft-margin SVM dual, and how does it differ from the hard-margin dual?
subject to and .
The only difference from hard-margin: the box constraint . Slack and its multipliers vanish in the dual derivation; the entire effect of slack collapses to one upper bound.
What are the three categories of training point in a soft-margin SVM, indexed by and ?
Type Position Not a SV Strictly outside margin Margin SV Exactly on margin: Bound SV On margin / inside / misclassified Only margin SVs can be used to compute — bound SVs have in general.
Why is sparsity weakened (but preserved) in soft-margin SVM compared to hard-margin?
Hard-margin: only points exactly on the margin have — typically a tiny fraction. Soft-margin: every margin violator also has , expanding the active set. But points comfortably outside the margin still have and contribute nothing to predictions. So sparsity weakens (more support vectors) but doesn’t vanish.
Sequential Minimal Optimization
What is Sequential Minimal Optimization (SMO), and why update two multipliers at a time rather than one?
SMO solves the SVM dual by picking a small subset of multipliers, optimising over them analytically, and iterating. The minimum subset size is two because of the equality constraint : Picking just one multiplier with everything else fixed pins it in place — no movement possible. Two multipliers can move while preserving the constraint.
What is the analytic update in SMO for the second multiplier ?
where is the prediction error. The denominator is — the squared distance between the two examples in feature space. The numerator scales with error disagreement.
After computing the analytic SMO update, why must the result be clipped, and what is the clipping interval?
Because the candidate update may push out of or push the paired out of its box. The feasible interval depends on whether the labels match:
- Same labels ():
- Different labels ():
Then clip: , and recover from the equality constraint.
What is the maximum-step heuristic for choosing the second multiplier in SMO?
After picking , choose to maximise — the largest disagreement between cached prediction errors. This approximates the largest update size and accelerates convergence. SMO converges for any pair-selection rule, but heuristics matter hugely — random-random pair selection can be 10×–100× slower.
Restate the SVM KKT optimality conditions in terms of alone.
Condition Geometric meaning Outside margin; not a SV On margin; margin SV On / inside / violating margin; bound SV When every example satisfies its KKT condition within tolerance, the dual is at its optimum.
Practical Comparison
Why is the soft-margin SVM dual still a convex quadratic program despite the added slack?
Because in the dual, slack disappears entirely — only the box constraint remains. The dual objective is concave (negative-definite quadratic form in via the kernel Gram matrix), and the constraints are linear. Standard convex QP. Strong duality still holds because the primal is convex.
Why use only margin support vectors (and not bound SVs) to compute the bias ?
A margin SV has , which forces via complementary slackness, which pins the point exactly on the margin: . Solving for gives the correct value. Bound SVs () have , so generally — substituting gives the wrong . Average over all margin SVs for numerical stability.