Machine learning----SVM (3) Kernel function __ function

Source: Internet
Author: User

This article mainly refers to the blog: http://blog.pluskid.org/?p=685 More detailed explanation can refer to the original blog.

1, why the introduction of the nuclear function?

In order to answer this question, let us first explain what is linear and cannot be divided into data. As shown in the left figure, if the data can be separated by a straight line or a hyperplane, it is linearly inseparable. So what is linear irreducible data. As shown in the image below, we cannot use a straight line or a hyperplane to separate the data.

Unfortunately, we introduced the SVM is a linear classifier, that is, the processing of linear data, for the upper right of the data presented in the previous SVM is helpless.

But here's the question----Why don't we learn a non-linear classifier for the right graph? I personally think that such a non-linear classification is not universal, because there may be many kinds of linear irreducible, we can not learn a classifier for each type. So the only way to do this is to think of ways to convert linear data into linearly measurable.

2, how the linear data can not be divided into linear.

When the low dimension data is converted into high-dimensional data, the linear irreducible data can be transformed into linear and measurable. For example, we have the right picture above.

For the data on the right, an ideal demarcation should be a "circle" rather than a line (hyperplane). If we use X1 and X2 to represent the two coordinates of this two-dimensional plane, we know that the equation of a two-time curve (a special case of a circle of two curves) can be written in this form:

(1)

Notice the form above, if we construct another five dimensional space, where the values of the five coordinates are Z1=X1, z2=x21, z3=x2, z4=x22, z5=x1x2, then obviously the above equation can be written in a new coordinate system:

(2)

Description: Make a simple explanation to the above. The x1,x2 is the two axes of the two-dimensional plane, the x axis and the y axis. (1) The formula is a two-dimensional plane circle expression, if we take X1, x1^2,x2,x2^2, x1x2 Five variables as the new axis, we can get (2) formula. We found that (2) is a hyperplane in 5-D space. So we're going right back to the problem of solving the hyperplane. Are you happy?

3. What about the dimension explosion? A grand debut of the nuclear function

It may have been discovered that two-dimensional linear data can be converted to a linear variational need to be converted to five dimensions, and if the dimension becomes larger, the converted dimension will not be even larger or infinitely dimensional. So we have no way of calculating. Then the nuclear function came to a grand debut. The purpose of a kernel function is to compute in a low dimension, but the effect is equivalent to being in a high-dimensional computation, so that we can simplify our calculations. Here to steal a lazy stick two pictures bar.



From the above we can see two-dimensional to five dimensional transformation, we only need in the low dimensional computation, can realize and in the high dimensional operation the same result, this is the function.

We call the function here to compute the inner product of the two vectors in the mapped space is called the kernel function (Kernel function), for example, in just the example, our kernel function is:

(3)


4. How to use kernel function in SVM?

To review our most primitive classification functions, according to the previous blog (7), the classification function becomes:

(4)

In the upper-type <Xi,X> is to compute the inner product of two vectors.

The x in the formula is two-dimensional, and the classification function mapped to the five dimension is:

(5)

In the same vein, the goal function we finally got from our last blog was converted to five-D space to get:

(6)

We take the form of the previously defined kernel function (3) and bring it into (6) with the following formula:

(7)

So we don't have to compute in the high dimensional space.

But there's a problem, the mapping we're talking about is constructed by hand, so how do we construct mappings for other data? Fortunately, the type of nuclear function is not a lot, we just choose from the appropriate data for their own.

5, the type of kernel function

1, the polynomial core, obviously the example we just cited is a special case of the polynomial kernel (r=1,d=2). Although it is troublesome and unnecessary, the mapping of the nucleus is actually written, and the dimension of the space is, where M is the dimension of the original space.

2, Gauss Core, this core is the first mention of the original space will be mapped to the infinite dimensional space of the guy. However, if Σ chooses very large, the weight of the higher-order feature actually decays very fast, so actually (a numerical approximation) is equivalent to a low dimensional subspace; Conversely, if Σ is chosen very small, you can map any data to a linear point of--of course, it's not necessarily a good thing, Because the following may be a very serious problem of fitting out. In general, however, by regulating the parameters σ, the Gaussian core is actually quite flexible and is one of the most widely used kernel functions.

3, linear core κ (X1,X2) =⟨x1,x2⟩, which is actually the inner product of the original space. The main purpose of this nuclear existence is to unify the form of "problems in the mapped space" and "problems in the space before mapping".

Summary: (by the word of the Great God) for nonlinear situations, SVM is to select a kernel function κ (⋅,⋅), by mapping the data to the high-dimensional space, to solve the problem of linear irreducible in the original space. Because of the excellent quality of the kernel function, it is very rare that such nonlinear expansion is not much more complicated than the original. Of course, this is thanks to the nuclear method-except for SVM, any method that calculates the inner product of a number of points can be nonlinear extended using a kernel method.


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.