Dual Support Vector Machine
Pre-requisite: Separating Hyperplanes in SVM
The Lagrange multiplier equation for the support vector machine. The equation of that can be given by:
Now, according to the duality principle, the above optimization problem can be viewed as both primal (minimizing over w and b) or dual (maximizing over a).
Slater condition for convex optimization guarantees that these two are equal problems.
To obtain minimum wrt w and b, the first-order partial derivative wrt these variables must be 0:
Now, put the above equation in the Lagrange multiplier equation and simplify it.
In the above equation, the term
To find b, we can also use the above equation and constraint
Now, the decision rule can be given by:
Notice, we can observe from the above rule that the Lagrange multiplier just depends upon the dot product of xi with unknown variable x. This dot product is defined as the kernel function, and it is represented by K
Now, for the linearly inseparable case, the dual equation becomes:
Here, we added a constant C, it is required because of the following reasons:
- It prevents the value of
- It also prevents the models from overfitting, meaning that some misclassification can be accepted.
we apply transformation into another space such that the following. Note, we don’t need to specifically calculate the transformation function, we just need to find the dot product of those to get kernel function, however, this transformation function can be easily established.
The intuition behind that many of time a data can be separated by a hyperplane in a higher dimension. Let’s look at this in more detail:
Suppose we have a dataset that contains only 1 independent and 1 dependent variable. The plot below represents the data:
Now, in the above plot, it is difficult to separate a 1D-hyperplane (point) that clearly separates the data points of different classes. But when this transformed to 2d by using some transformation, it provides options for separating the classes.
In the above example, we can see that an SVM line can clearly separate the two classes of the dataset.
There is some famous kernel that is used quite commonly:
- Polynomials with degree =n
- Polynomials with degree up to n
- Gaussian/ RBF kernel
((569, 2), (569,))
Attention reader! Don’t stop learning now. Get hold of all the important Machine Learning Concepts with the Machine Learning Foundation Course at a student-friendly price and become industry ready.