Machine Learning Support vector Machine (ii): SMO algorithm

Source: Internet
Author: User

Note: About support vector Machine series articles are drawn from the divine work of the Great God and written in their own understanding; If the original author is compromised please inform me that I will deal with it in time. Please indicate the source of the reprint.

Order:

In the support Vector machine series, I mainly talk about the support vector machine formula derivation, the first part of the introduction of Lagrange dual function of the dual factor α, the second part is the SMO algorithm for the dual factor solution; The third part is the principle and application of kernel function, the reasoning of kernel function and the common kernel functions. The Forth part is the application of support vector machine, which is explained in detail according to the Code of machine learning actual combat.

1 Concept of SMO algorithm

To add that, the following K () function is a kernel function, which is to project low-dimensional data into a higher dimension, that is, to convert the nonlinearity into a linear classification. Knowing that k is the kernel function is okay, and the K function will be explained in detail later. In the previous article we obtained a formula for the duality factor, which is very large, and now the added symbol is converted into a minimum, and the two are equivalent.

Converted target function:

In the constraint condition, C is the penalty coefficient, which is obtained by the nonlinearity plus the relaxation factor.

In 1998, the Sequence Minimum optimization algorithm (SMO) proposed by Platt can solve the SVM problem efficiently, it decomposes the original solution of n parameter two quadratic programming into many sub-two programming problems, and each sub-problem only needs to solve 2 parameters, the method is similar to the coordinate rising, Save time costs and reduce memory requirements. Each heuristic chooses two variables to be optimized, looping continuously until the function's optimal value is reached.

2 SMO algorithm principle analysis

Our goal: Solving dual factor α (α1,α2, ..., αn)

2.1 Objective functions into two-tuple functions

SMO algorithm is to select two parameters by certain rules to optimize, and fixed the remaining N-2 parameters, if the selected parameters are α1,α2, fixed α3,α4, ..., αn, the objective function is reduced to two yuan function:

It is emphasized here that the Kij in the equation is a kernel function, knowing the meaning can be, not understanding the derivation of the SMO algorithm is not affected.

2.2 Convert two-dollar functions into unary functions

Constraint conditions:

Get, where ζ is a fixed value.

Multiply both sides by multiplying the Y1, simplifying to get:

The (2) type is brought into (1) to be:

2.3 Finding the extremum point for a unary function

The derivative of the (3) formula is equal to 0, which is:

Assuming the value of the solution, recorded as α1new,α2new pre-optimization of the solution is α1old,α2old, by the constraints are known:

Get:

The support vector Machine Super plane model is: F (x) =ωtx + B, ω=σαi Yi Xi i.e. F (xi) is the predicted value of the sample XI, Yi represents the true value of Xi, then the EI represents the error value.

Due to:

The above equation (4) (6) (7) is brought into the derivation formula, at this time the solution of α2new does not take into account the constraints, first recorded as α2new unclipped, obtained:

To bring in (5) the formula:

2.4 Obtaining the final duality factor

The above-obtained α2new unclipped does not consider the constraint conditions:

When and XOR, that is, one is 1, and one is-1, they can be represented as a straight line with a slope of 1.

The horizontal axis is that the longitudinal axes are, and both in the rectangle box and also in the straight line, so L <= α2new <= H

The resulting value:

Again according to get α1new:

2.5 Evaluation of critical conditions

For most cases η= K11 + k22-2k12 > 0, Solution is as above, but η<= 0, Α2new take the critical point L or H.

When η<0 , the objective function is a convex function, there is no minimum value, the extremum is obtained at the boundary of the defined domain.
When η=0 , the objective function is a monotone function, and the extremum is also taken at the boundary.

Calculation method:

3 heuristic selection of variable 3.1 selection of the first variable

The choice of the first variable, called the outer Loop, first iterates through the entire sample set, selecting a violation of the KKT condition.αi As the first variable, then select the second variable according to the relevant rules (see analysis below), the two variables are optimized using the above method. When the entire sample set is traversed, the non-boundary sample set is traversed (0<αI<C ) in violation of KKTαi As the first variable, the second variable is also selected according to the relevant rules, and the two variables are optimized. Once the non-boundary sample set is traversed, it is returned to traverse the whole sample set, which is to switch back and forth between the entire sample set and the non-boundary sample set, looking for a violation of the KKT condition. αi as a first variable. The Kkt condition α I is not violated until the entire sample set is traversed, and then exits.

3.2 Selection of the second variable

SMO says that the second variable selection process is an inner loop, assuming that the first variable in the outer loop is recorded as aα1 , the choice of the second variable wants to makeα2 There are larger changes due toα2 is dependent on| E1? E2| WhenE1 is a positive time, then select the smallestEi AsE2 IfE1 is negative, select the maximumEi AsE2 , usually for each sample of theEi Save in a list, select the largest| E1? E2|  To approximate the maximum step size.

4 calculation of the threshold B

After each optimization of the two variables, the threshold B is updated as it relates to the calculation of f (x), which is related to the next optimization.

This part concludes that the optimal equation F (x) =ωtx + B is obtained by the value of the dual factor solved by the SMO algorithm, i.e., the sample can be divided. Most of the above reference don't float Sha build Gao platform blog article, he wrote is already very clear, I just on his basis

Add or delete content that is not well understood. The following is an explanation of the kernel functions and kkt conditions.

Reference:

1 Anatomy of "machine learning in detail" SMO algorithmhttp://blog.csdn.net/luoshixian099/article/details/512277542 Support vector Machine (v) SMO algorithm

3 Introduction to support vector machines (understanding of the three-tier realm of SVM)

Machine Learning Support vector Machine (ii): SMO algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.