# 一文读读懂SVM推导全过程

s.t   $\dpi{100} \large y_{i}(\frac{w*x_{i}+b}{||w||})>=\tilde{\gamma}$

max $\dpi{100} \large \hat{\gamma}$

s.t   $\dpi{100} \large y_{i}(\frac{w*x_{i}+b}{||w||})>=\hat{\gamma}$

Min  $\dpi{100} \large \frac{1}{2}{\left \| w \right \|}^{2}$

s.t   $\dpi{100} \large y_{i}(w*x_{i}+b)-1>=0$

Min f(x)

subject to: $\dpi{100} \large g_{i}(x)$<=0 ，$\dpi{100} \large h_{j}(x)$=0.

Min $\dpi{100} \large f(x)+\sum_{i=1}^{m}\mu _{i}g_{i}(x)+\sum_{j=1}^{l}\lambda _{j}h_{j}(x)$

Subject to：

$\dpi{100} \large \mu _{i}g_{i}(x)=0$

$\dpi{100} \large \mu _{i}>=0$  for  i=1,2,3……N

$\dpi{100} \large L(w,b,\alpha )=\frac{1}{2}{\left \| w \right \|}^{2}-\sum_{i=1}^{N}\alpha _{i}y_{i}(w.x_{i}+b)+\sum_{i=1}^{N}\alpha_{i}$

L(w,b,$\dpi{100} \large \alpha$)对w,b求偏导数并令其等于0.

$\dpi{100} \large w=\sum_{i=1}^{N}\alpha _{i}y_{i}x_{i}$

$\dpi{100} \large \sum_{i=1}^{N}\alpha _{i}y_{i}=0$

Min $\dpi{100} \large L(w,b,\alpha )=-\frac{1}{2}\sum_{i=1}^{N}\sum_{j=1}^{N}\alpha _{i}\alpha _{j}y_{i}y_{j}x_{i}x_{j}+\sum_{i=1}^{N}\alpha_{i}$

Min  $\dpi{100} \large \frac{1}{2}\sum_{i=1}^{N}\sum_{j=1}^{N}\alpha _{i}\alpha _{j}y_{i}y_{j}x_{i}x_{j}-\sum_{i=1}^{N}\alpha_{i}$

s.t    $\dpi{100} \large \sum_{i=1}^{N}\alpha _{i}y_{i}=0$

$\dpi{100} \large \alpha_{i}\geq 0$

$\dpi{100} \large w^{*}=\sum_{i=1}^{N}\alpha _{i}^{*}y_{i}x_{i}$

$\dpi{100} \large b^{*}=y_{j}-\sum_{i=1}^{N}\alpha _{i}^{*}y_{i}x_{i}x_{j}$

Min  $\dpi{100} \large \frac{1}{2}{\left \| w \right \|}^{2}+C\sum_{1}^{N}\xi_{i}$

s.t    $\dpi{100} \large y_{i}*(w*x_{i}+b)\geq 1-\xi_{i}$

Min  $\dpi{100} \large \frac{1}{2}\sum_{i=1}^{N}\sum_{j=1}^{N}\alpha _{i}\alpha _{j}y_{i}y_{j}x_{i}x_{j}-\sum_{i=1}^{N}\alpha_{i}$

s.t    $\dpi{100} \large \sum_{i=1}^{N}\alpha _{i}y_{i}=0$

$\dpi{100} \large 0\leq \alpha _{i}\leq c$