Professional Documents
Culture Documents
Dual in SVM
Diego Canales by ChatGPG
Primal Problem
The primal problem for a Soft Margin Support Vector Machine (SVM) can be formulated as follows:
N
1 X
min ∥w∥2 + C ξi
w,b,ξ 2 i=1
(1)
subject to yi (wT xi + b) ≥ 1 − ξi ,
ξi ≥ 0, ∀i.
Here, w represents the weight vector, b is the bias, and ξi are the slack variables that allow for misclassification
of data points.
Lagrangian Formulation
To transform the primal problem into its dual, we introduce the Lagrangian by adding Lagrange multipliers
for each constraint. We have two sets of constraints, hence two sets of Lagrange multipliers: αi for the
constraint yi (wT xi + b) ≥ 1 − ξi and µi for the constraint ξi ≥ 0.
The complete Lagrangian is given by:
N N N
1 X X X
L(w, b, ξ, α, µ) = ∥w∥2 + C ξi − αi [yi (wT xi + b) − 1 + ξi ] − µi ξi . (2)
2 i=1 i=1 i=1
1
implying the dual feasibility condition for α:
N
X
αi yi = 0. (6)
i=1
3. With respect to ξi :
∂L
= C − αi − µi = 0 (7)
∂ξi
establishing the relationship between αi , µi , and the penalty parameter C:
αi + µi = C. (8)
µi ξi = 0 (10)
αi ≥ 0 (11)
µi ≥ 0. (12)
Since µi ξi = 0 for all i, and considering the dual feasibility and complementary slackness conditions, the
terms involving µi can be omitted, leading to the simplified Lagrangian solely in terms of α.
subject to:
0 ≤ αi ≤ C, ∀i, (15)
N
X
αi yi = 0. (16)
i=1
Maximizing this Lagrangian subject to these constraints leads us to the optimal values of αi , which in
turn allow us to find the optimal w and b for the primal problem. The non-zero αi correspond to the support
vectors.