Back to Classic ML Mind Map
中文·English
📊 Classic MLID: svm-margin

SVM Margin & Duality

SVM 最大间隔与对偶
🎯Core Definition
SVM finds the hyperplane with maximum geometric margin. In the separable case the constraint yi(wTxi+b)1y_i(w^Tx_i + b) \ge 1 (normalized functional margin) yields geometric margin 2w\frac{2}{\Vert w\Vert}, so maximizing it is equivalent to minimizing 12w2\frac{1}{2}\Vert w\Vert^2. With Lagrange multipliers αi0\alpha_i \ge 0, L(w,b,α)=12w2i=1nαi[yi(wTxi+b)1]L(w, b, \alpha) = \frac{1}{2}\Vert w\Vert^2 - \sum_{i=1}^{n} \alpha_i [y_i(w^Tx_i + b) - 1]; setting derivatives w.r.t. w,bw, b to zero gives w=iαiyixiw = \sum_i \alpha_i y_i x_i and iαiyi=0\sum_i \alpha_i y_i = 0, and substituting back yields the dual maxαiαi12i,jαiαjyiyjxiTxj\max_{\alpha} \sum_i \alpha_i - \frac{1}{2}\sum_{i,j} \alpha_i \alpha_j y_i y_j x_i^Tx_j s.t. αi0, iαiyi=0\alpha_i \ge 0,\ \sum_i \alpha_i y_i = 0. The KKT complementary-slackness condition αi[yi(wTxi+b)1]=0\alpha_i[y_i(w^Tx_i + b) - 1] = 0 means only samples on the margin boundary (yi(wTxi+b)=1y_i(w^Tx_i+b) = 1) have αi>0\alpha_i > 0; these are the support vectors, and f(x)=iSVαiyixiTx+bf(x) = \sum_{i \in SV} \alpha_i y_i x_i^Tx + b depends only on them.
💡Use Cases
the classic whiteboard 'derive the SVM dual' and 'why do only support vectors matter'; prerequisite for the kernel trick (dual inner products xiTxjx_i^Tx_j get replaced by a kernel).
Key Problems Solved
the primal is convex QP with inequality constraints where KKT is both necessary and sufficient; Lagrangian duality rewrites it in terms of inner products only, which kernels can replace for implicit high-dimensional mapping — and complementary slackness compresses the model to nSVn_{SV} support vectors: O(nSVd)O(n_{SV} \cdot d) storage, and each prediction is just inner products with support vectors, decoupled from the full training set.
🎯5 High-Frequency Exam Points
1
Whiteboard the SVM dual: write L=12w2iαi[yi(wTxi+b)1]L = \frac{1}{2}\Vert w\Vert^2 - \sum_i \alpha_i[y_i(w^Tx_i + b) - 1], take w,bw, b derivatives, substitute back, and state the full dual objective with constraints.
2
Geometric meaning of KKT complementary slackness αi[yi(wTxi+b)1]=0\alpha_i[y_i(w^Tx_i+b) - 1] = 0: why αi=0\alpha_i = 0 for non-support vectors and how support vectors are identified?
3
Geometric vs functional margin: derive why the margin is 2w\frac{2}{\Vert w\Vert} and why we normalize the functional margin.
4
Derive f(x)=iSVαiyixiTx+bf(x) = \sum_{i \in SV} \alpha_i y_i x_i^Tx + b: why is ww a linear combination of support vectors, and what are the train/infer complexities?
5
Why can the dual be kernelized? Which terms in the dual contain only inner products, and where does the primal lack inner products?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "SVM Margin & Duality"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardMulticlass Strategies: OvR/OvO/SoftmaxNext CardSoft Margin & Hinge

🔗 More Classic ML Knowledge Cards

AdaBoost DerivationBagging & Random ForestBaum-Welch (HMM EM)GBDT Negative Gradient