SVM
Here I just realize a simple SVM which only supports binary classification, named C-SVC.
代码在Github
Formulation
Linear
max γs.t.yi(wxi+b)|w|≥γ m a x γ s . t . y i ( w x i + b ) | w | ≥ γ
Due to γ=γ¯|w| γ = γ ¯ | w | , and we can scale |w| | w | to scale γ¯ γ ¯ , so we define γ¯ γ ¯ as 1.Then, the above formulation is as following:
max 1|w|s.t.yi(wxi+b)≥1 m a x 1 | w | s . t . y i ( w x i + b ) ≥ 1
That equals:
min