3.3 Quadratic Programming

DATA 442/642 · Week 3 · PDF · HTML slides · PDF slides

A convex quadratic with linear constraints. SVM is the running example.

These notes walk through the lecture slides. The original deck is unchanged. On the course hub, HTML slides move one page at a time, and the PDF is the same deck.

The notes follow Deisenroth, Faisal, and Ong, Mathematics for Machine Learning.

1. Quadratic cost, linear constraints

A quadratic program keeps linear inequalities and lets the objective be quadratic. That is the next step past an LP: nonlinear models whose cost is a bowl, plus the same polyhedron as before.

This is also how regularization enters: a quadratic penalty on θ is still a QP when the constraints stay linear. Soft-margin SVM is the example this course cares about.

minθ∈ℝd12θ⊤Qθ+𝐜⊤θsubject toAθ≤𝐛,

with A∈ℝm×d, 𝐛∈ℝm, 𝐜∈ℝd, and Q∈ℝd×d symmetric positive definite. Then the objective is convex, so a local min is the unique global min. Still d variables and m linear constraints.


2. Dual

Lagrangian

ℒ(θ;λ)=12θ⊤Qθ+𝐜⊤θ+λ⊤(Aθ−𝐛).

Stationarity in θ:

Qθ+(𝐜+A⊤λ)=0.

If Q is invertible,

θ=−Q−1(𝐜+A⊤λ).

Substitute back. The dual Lagrangian is the concave quadratic

D(λ)=−12(𝐜+A⊤λ)⊤Q−1(𝐜+A⊤λ)−λ⊤𝐛.

The dual problem is therefore

maxλ∈ℝm−12(𝐜+A⊤λ)⊤Q−1(𝐜+A⊤λ)−λ⊤𝐛subject toλ≥0.

Week 5 does the same substitution for the SVM dual, then replaces inner products by a kernel.


3. Why SVM is a QP

Soft-margin SVM:

minθ∈ℝl&12‖θ‖2+C∑n=1Nξnsubject to&yn(xn⊤θ+b)≥1−ξn,ξn≥0.
  • θ: hyperplane weights.
  • C: trade-off between margin size and slack.
  • ξn: slack; a point may sit on the wrong side of the margin, at a linear cost.

Quadratic objective, linear inequalities: a QP, not an LP, because of ‖θ‖2.


4. Practice

  1. Why is a soft-margin SVM a quadratic program?

  2. What does Q positive definite buy you that a general quadratic objective does not?

  3. After θ=−Q−1(𝐜+A⊤λ), what variables does the dual still optimize, and what constraint remains on them?