A brief Introduction here. (Wrote a blog about it last year, but do not think it is detailed.)
This blog is learning notes from this video (English slides but Chinese speaker). First a quick introduction on SVM, then the magic of how to solve max/min values. Also, you could find Kernel SVM.
Hard-Margin Support Vector Machines
Shown in the graph, we have two classes (circles and triangles) and we want to separate them by one single line. Note that here we consider they are linear separatable, and use a straight line.
So the goal is to find the blue line, but what is a “good” line? Because you might find a number of lines that can separate the two classes. That is those dots should be as far as they could to the blue line. We find some lines that are parallel to the blue one, then always there are two lines (dash lines) reach the closest sample (or more than one). Then we define the distances of both two lines to the blue line as margin. The goal for SVM is to find a max value of margin.
Notations:
Blue line (the wanted line):
Dots above the blue line, the tags are +1:
Dots below the blue line, the tags are -1:
margin
Goal: max {margin}
Max the Margin
Refresh our mind, how do you calculate distance of two lines:
So for the dash line1: and blue line:
:(two features x1 and x2)
=>
=>
(You will find d+ and d- are the same)
So we have , recall the goal is to find a max value of it. Thus, the min value of ||w||. Then we define a loss function:
, the goal is to find max
. So do we have constraints for
? Yes, we have:
if
if
They are equal to .
So the problem becomes, given a function , which is subjected to
, then find out the max value of
.
Lagrange Multipliers
Define our L expression:
1) Get relationship of w and
We let , where we have
Then we will get .
* *More detailed: how to get (the first term of the above equation)
Recall , then
, then:
.
2) Get relationship of b and
Let .
, but we found it is totally eliminating b.
Then the problem becomes:
The job is to find out the when we have the max value of
. Also, very easy to deal with the second term of the L expression.
One thought on “Understanding SVM(2)”