Cs · Computer Science

Why Are Most Lagrange Multipliers Zero in an SVM?

Published By the 9to5Science editorial team

At a glance

  1. 1. Write the margin conditions

    An SVM requires each training point to satisfy a margin constraint, allowing slack in the soft-margin case.

  2. 2. Apply complementary slackness

    A constraint that is strictly inactive must have a zero multiplier.

  3. 3. Identify support vectors

    Points with positive multipliers lie on or inside the margin and determine the fitted boundary.

  4. 4. Check the qualification

    Soft-margin multipliers are bounded, so points inside the margin can have multipliers equal to the upper bound.

Advertisement

In a support vector machine (SVM), each training example contributes a constraint to the optimization problem and receives a Lagrange multiplier. Most multipliers are zero because most training examples lie safely beyond the required margin. Their constraints do not affect the optimum, so complementary slackness assigns them zero multipliers.

The examples with positive multipliers are called support vectors. They lie on or inside the margin and determine the learned decision boundary. The exact conditions differ slightly between hard-margin and soft-margin SVMs.

The hard-margin condition

For labeled data (xi,yi)(x_i,y_i), where yi∈{−1,+1}y_i\in\{-1,+1\}, a linear hard-margin SVM finds ww and bb that minimize 12∥w∥2\frac{1}{2}\lVert w\rVert^2, subject to

yi(w⋅xi+b)≥1.y_i(w\cdot x_i+b)\geq 1.

The quantity yi(w⋅xi+b)y_i(w\cdot x_i+b) is the point’s signed margin score. A score of 11 puts the point on its class’s margin boundary; a score greater than 11 puts it beyond that boundary.

Associate a multiplier αi≥0\alpha_i\geq 0 with each constraint. The Karush–Kuhn–Tucker complementary-slackness condition is

αi(yi(w⋅xi+b)−1)=0.\alpha_i\bigl(y_i(w\cdot x_i+b)-1\bigr)=0.

For this product to be zero, either the constraint is tight, or its multiplier is zero. In particular, if a point is strictly beyond the margin, then yi(w⋅xi+b)>1y_i(w\cdot x_i+b)>1, so its multiplier must satisfy αi=0\alpha_i=0. A point on the margin may have a positive multiplier.

What changes with a soft margin?

Real datasets may not be perfectly separable. A soft-margin SVM introduces slack variables ξi≥0\xi_i\geq 0 and typically minimizes

12∥w∥2+C∑iξi\frac{1}{2}\lVert w\rVert^2+C\sum_i\xi_i

subject to

yi(w⋅xi+b)≥1−ξi.y_i(w\cdot x_i+b)\geq 1-\xi_i.

Here C>0C>0 controls the trade-off between a wide margin and penalizing violations. The dual multipliers now satisfy 0≤αi≤C0\leq\alpha_i\leq C. Complementary slackness includes

αi(yi(w⋅xi+b)−1+ξi)=0.\alpha_i\bigl(y_i(w\cdot x_i+b)-1+\xi_i\bigr)=0.

Thus, if a point is strictly outside the margin, its constraint is inactive and αi=0\alpha_i=0. If 0<αi<C0<\alpha_i<C, the point lies exactly on the margin. If αi=C\alpha_i=C, it may be on the margin or inside it, including a point that is misclassified. So the soft-margin statement is not simply “positive multiplier means exactly on the margin.”

A worked one-dimensional example

Take four points on a line:

  • Class −1-1: x=−2x=-2 and x=−1x=-1.
  • Class +1+1: x=1x=1 and x=2x=2.

The maximum-margin separator is at x=0x=0, so one optimal classifier has w=1w=1 and b=0b=0. The signed margin score is yixiy_i x_i. The inner points, x=−1x=-1 and x=1x=1, each have score 11 and lie on their respective margin boundaries. The outer points, x=−2x=-2 and x=2x=2, each have score 22 and are strictly beyond the margin.

Consequently, complementary slackness sets the outer points’ multipliers to zero. The two inner points can have positive multipliers. In fact, setting each to 1/21/2 satisfies the hard-margin stationarity conditions: w=∑iαiyixi=1w=\sum_i\alpha_i y_i x_i=1, and ∑iαiyi=0\sum_i\alpha_i y_i=0. The inner points are the support vectors; moving or removing a point well beyond the margin need not change this solution.

Why only support vectors affect the classifier

The stationarity condition for the weights is

w=∑iαiyixi.w=\sum_i\alpha_i y_i x_i.

For a kernel SVM, the corresponding prediction uses

f(x)=∑iαiyiK(xi,x)+b,f(x)=\sum_i\alpha_i y_i K(x_i,x)+b,

where KK is the kernel function. Terms with αi=0\alpha_i=0 vanish, so those training points do not directly contribute to the decision function. This is why an SVM can have a representation involving only a subset of the training data.

The optimization does not explicitly require a particular percentage of zero multipliers. Sparsity arises because many constraints are inactive at the optimum. How many support vectors there are depends on the data, the kernel, the regularization setting, and whether points are duplicated or lie on the margin. Some datasets can have many support vectors, or even have every point contribute.

Common mistakes

  • Thinking every multiplier must be positive. Multipliers are constrained to be nonnegative, not strictly positive. Inactive constraints have zero multipliers.
  • Assuming every point on the margin must have a positive multiplier. Complementary slackness gives a necessary relationship, but a tight constraint can still have a zero multiplier, for example in a degenerate solution.
  • Treating all soft-margin support vectors alike. A multiplier strictly between 00 and CC indicates a point on the margin; a multiplier at CC can indicate a point inside it or a margin violation.
  • Confusing zero multipliers with zero training error. A point can be misclassified in a soft-margin SVM and have a positive multiplier at the upper bound. Zero multipliers describe inactive constraints, not a general guarantee about classification accuracy.

References

  1. Support-Vector Networks, Corinna Cortes and Vladimir Vapnik, Machine Learning (1995)
  2. Convex Optimization, Stephen Boyd and Lieven Vandenberghe

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.