← 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 2∥w∥\frac{2}{\Vert w\Vert}, so maximizing it is equivalent to minimizing 12∥w∥2\frac{1}{2}\Vert w\Vert^2. With Lagrange multipliers αi≥0\alpha_i \ge 0, L(w,b,α)=12∥w∥2−∑i=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αi−12∑i,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. αi≥0, ∑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)=∑i∈SVα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(nSV⋅d)O(n_{SV} \cdot d) storage, and each prediction is just inner products with support vectors, decoupled from the full training set.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of SVM Margin & Duality.
Use Cases
In production engineering, what are the primary use cases for SVM Margin & Duality and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Whiteboard the SVM dual: write L=12∥w∥2−∑iα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 2∥w∥\frac{2}{\Vert w\Vert} and why we normalize the functional margin.
4
Derive f(x)=∑i∈SVα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 Card →Soft Margin & Hinge

🔗 More Classic ML Knowledge Cards

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