Machine learning &&andrew NG Course Review---How to choose the machine learning method, System

Source: Internet
Author: User

We all say that the problem of dual (the mathematical slag is only the understanding of its concept) in the machine learning application is very extensive, so write down (in fact, access to records) the following about dual knowledge, this set of theories not only applies to SVM optimization problem, but for all constrained optimization problems are applicable, is an important part of the optimization theory. (Perhaps you think an IT person optimization problem is not important, in fact, you think about, the reality of a lot of problems, are conditional constraints in the case of the optimal problem) simply speaking, any constrained optimization can be written in this form:

MinF0 (x)

s. T. fi (x) ≤0,i=1,...,m

Hi (x) =0,i=1,...,p

The natural language description of the above formula is: in the condition fi (x) ≤0,i=1,..., m and Hi (x) =0,i=1,..., p is simultaneously established, the minimum value of F0 (x) is obtained. S.t:subject to meaning to make, condition is wait.

Formal unification simplifies the unnecessary complexity of the derivation process. Other forms can be normalized to a standard form, such as a MAXF (x) that can be converted to min?f (x), and so on. If F0,F1,..., FM are all convex functions , and H1,..., hp are all affine functions (as in the form of ax+b), then the problem is called convex optimization (convex optimization). The convex optimization problem has many excellent properties, such as its extremum is unique. However, here we do not assume that the optimization problem to be handled is a convex optimization problem. (What is convex?) A convex set is a set of points where any two points are connected to a straight line, and the point on the line is still inside the set, so that "convex" is very image. For example, for a convex function (in the mathematical representation, the satisfying constraint is the affine function, which is the linear ax+b form), the local optimality is the global optimal, but not for the non-convex function. )


Although the constraints can help us to reduce the search space, but if the constraint itself is a more complex form, it is actually a very annoying problem, and we hope to transform the constrained optimization problem into unconstrained optimization problem. To do this, we define Lagrangian as follows:

L (x,λ,ν) = F0 (x) +∑λifi(x) +∑νihi( x) (λ, ν is Lagrangian multiplier)

It combines constraints and objective functions by a number of factors. Of course Lagrangian itself is not fun, now let's let him maximize for λ and ν, so that:

Z (x) =max L (x,λ,ν)

Here λ>0 understands that each element of the vector λ is non-negative. This function z (x) is equal to F0 (x) for those x that satisfy the original problem constraint, which is easy to verify because x that satisfies the constraint causes hi (x) to =0, so the last item is eliminated, and fi (x) ≤0, and we require λ>0, so Λifi (x) ≤0, so the maximum value can only be obtained when they are 0, and only F0 (x) is left at this time. Therefore, for those X that meet the constraints, F0 (x) =z (x). In this way, the original constrained optimization problem is actually equivalent to the unconstrained optimization problem as follows:

Minz(x)

Because if the original problem has an optimal value, then it must be an X that satisfies the constraint. obtained, and for all x, Z (x) and F0 (x) that satisfy the constraint are equal. As for those who do not meet the constraints of the X, the original problem can not be taken, otherwise the extremum problem is not solved. It is easy to verify that X has Z (x) =∞ for these conditions that do not satisfy the constraint, which is also consistent with the original problem, because the minimum worth to infinity can be considered compatible with "no solution". Here, we succeeded in turning the constraint problem into an unconstrained problem, but it was actually a formality rewrite, and there was no fundamental change. We just put the original question through Lagrangian writing the following form:

Min (Max L (x,λ,ν))

The problem (or primitive form of constraint) is called primal problem. If you have seen the derivation of the SVM before, then surely you will know that there is a dual problem, which is very similar in form, just swapping min and Max for a moment:

Max (min L (x,λ,ν))

After the exchange of dual problem and the original primal problem is not equal, intuitively, we can understand that: the fattest of the fat is more fat than the fat one of the lean bone. Of course this is very not strict, and the word can be entangled, so we still look at the strict mathematical description. Similar to the z (x) just now, we also use a notation to represent the inner layer of this function, in mind:

G (λ,ν) =MINXL (x,λ,ν)

It is said that G (λ,ν) is Lagrange dual function (do not confuse with L's Lagrangian). G has a good property that it is a lower bound of the primal problem. In other words, if the minimum value of primal problem is recorded as p? , then for all λ?0 and ν, we have:

G (λ,ν) ≤p?

Because for extreme points (which actually include all the points that satisfy the constraints) x?, notice that λ?0, we always have

∑λifi (x?) +∑νihi (x?) ≤0

So

L (x?,λ,ν) =f0 (x?) +∑λifi (x?) +∑νihi (x?) ≤F0 (x?)

So

G (λ,ν) =minl (x,λ,ν) ≤l (x?,λ,ν) ≤f0 (x?) =p?

This determines the nether nature of G, so

Maxg (λ,ν)

is actually the biggest nether. This is natural, because after we get the nether, we naturally want to get the best of the Nether, the largest one-because it is nearest to the value we are approaching. The best value of dual problem is D, according to the derivation above, we get the following properties:

D?≤p?

This property is called weak duality, which is true for all optimization problems. where P?? D? It is called duality Gap. It is important to note that no matter what form primal problem is, dual problem is always a convex optimization problem-its extrema are unique (if present) and there are ready-made packages to solve convex optimization problems (although solving General's convex optimization are actually very slow and can only solve smaller problems. Thus, for those primal problem that are difficult to solve (for example, even NP problems), we can obtain a lower bound estimate of the original problem by optimizing the dual problem by identifying its dual problem. Or we don't even have to optimize this dual problem, but instead (by some means, such as random) pick some λ?0 and ν, take it to G (λ,ν), and get some nether (but not necessarily the biggest one). Of course to choose λ and ν is not always "random" so easy, according to specific problems, sometimes the candidate λ and ν into G will get? ∞, this is a completely legal nether, but it does not bring us any useful information.

Since there is weak duality, obviously there will be strong duality. The so-called strong duality, is

D?=p?

This is a good property, strong duality is established, we can optimize primal problem by solving dual problem, which is what we do in SVM. Of course not all the problems can meet strong duality, in the time of the SVM we directly assume the establishment of the strong duality, here we will mention strong duality set up conditions.

Here we briefly introduce Slater conditions and KKT conditions. Slater condition refers to the existence of strict conditions to meet the constraints of the point X, where the "strict" refers to the fi (x) ≤0 "Less than or equal to" to strictly take "less than", that is, the existence of x satisfies

Fi (x) <0,i=1,..., m

Hi (x) =0,i=1,..., p

We have: If the original problem is convex and satisfies the Slater condition, then strong duality is established. It is important to note that this is only a case of the establishment of strong duality, not the only case. For example, strong duality is also established for some non-convex optimization problems. Here we might as well review the SVM primal Problem, which is a convex optimization problem (QP is a special case of convex optimization problem), and the Slater condition in fact here is equivalent to the existence of such a super-plane separates the data, that is Is "data can be divided". When the data is not divisible, strong duality can not be established, however, this time we look for the separation plane This problem itself is meaningless, as for how we map the data to the feature space to solve the problem is not divisible, is kernel kernel function problem, will be introduced later.

Let's go back to the duality topic. Take a look at some of the properties of strong duality when it was founded. Suppose X? and (λ?,ν?) are the extreme points of primal problem and dual problem respectively, and the corresponding extremum is P? and d? , first p?=d? , we can now get

F0 (x?) =g (λ?,ν?) =minx (F0 (x) +∑λ?ifi (x) +∑ν?ihi (x))

≤F0 (x?) +∑λi?fi (x?) +∑νi?hi (x?) ≤F0 (x?)

Since both ends are equal, all of the inequalities in this series can be replaced by equal signs. According to the first one, we can get x? is an extreme point of L (x,λ?,ν?), so you know L (x,λ?,ν?) in X? The gradient should be equal to 0, i.e.:

? F0 (x?) +∑i=1mλ?i?fi (x?) +∑i=1pν?i?hi (x?) =0

Furthermore, by the second inequality, it is clear that Λ?ifi (x?) is positive, so we can get

Λ?ifi (x?) =0,i=1,..., m

This condition is called complementary slackness. Obviously, if λ?i>0, then there must be fi (x?) =0; Conversely, if fi (x?) <0 so you can get λ?i=0.

To put together some other obvious conditions is the legendary KKT (karush-kuhn-tucker) Condition:

Fi (x?) ≤0,

Hi (x?) =0,

Λ?i≥0,

Λ?ifi (x?) =0,

? F0 (x?) +∑mi=1λ?i?fi (x?) +∑pi=1ν?i?hi (x?) =0

I=1,..., mi=1,..., pi=1,..., mi=1,..., m

Any problem satisfying the strong duality (which is not necessarily required by Slater conditions or is not necessarily a convex optimization problem) satisfies the KKT condition, in other words, it is a necessary condition for strong duality. However, when the original problem is convex optimization problem (of course, the one should function is also required to be micro, otherwise the KKT condition of the last formula is meaningless), KKT can be upgraded to the necessary and sufficient conditions. In other words, if the primal problem is a convex optimization problem, and the following solution x exists? and (λ?,ν) satisfy the KKT condition, they are the extreme points of primal problem and dual problem respectively, and strong duality is established.

Its proof is also relatively simple, first primal problem is convex optimization problem, g (λ,ν) =MINXL (x,λ,ν) solution for each set of fixed (λ,ν) is also a convex optimization problem, by the KKT condition of the last formula, Know x? is MINXL (x,λ?,ν ?) (if not a convex optimization problem, it is not necessarily available), i.e.:

G (λ?,ν?) =MINXL (x,λ?,ν?) =l (x?,λ?,ν?)

=F0 (x?) +∑i=1mλ?? IFI (x?) +∑i

=1pνi?? Hi (x?) =F0 (x?)

The final formula is based on the second and fourth conditions of the KKT condition. Since G is the lower bound of F0, this proves that duality gap is zero, that is to say, strong duality is established.

So far, do a summary. We briefly introduced the concept of duality, and basically did not give any concrete examples. However, because the content is more, in order to avoid the article super-long, I picked some focus on a bit. In general, an optimization problem, by finding out its dual problem, we can at least get a lower bound to the original problem in the case where only weak duality is established. If the strong duality is established, the dual problem can be solved directly to solve the original problem, just like the classical SVM solution process. It is possible that dual problem is easier to solve than primal problem, or dual problem has some excellent structures (for example, through dual problem in SVM, we can represent the problem as an inner product of the data, thus making kernel tric K application is possible). In addition, there are some cases of simultaneous solution of dual and primal problem, for example, in the process of iterative solution, by judging the size of the duality gap, a valid iterative stop condition can be obtained.



Machine learning &&andrew NG Course Review---How to choose the machine learning method, System

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.