This article is about machine learning. For polynomial kernels in complexity theory, seeKernelization.
Illustration of the mapping. On the left a set of samples in the input space, on the right the same samples in the feature space where the polynomial kernel (for some values of the parameters and) is the inner product. The hyperplane learned in feature space by an SVM is an ellipse in the input space.
Inmachine learning, thepolynomial kernel is akernel function commonly used withsupport vector machines (SVMs) and otherkernelized models, that represents the similarity of vectors (training samples) in a feature space over polynomials of the original variables, allowing learning of non-linear models.
Intuitively, the polynomial kernel looks not only at the given features of input samples to determine their similarity, but also combinations of these. In the context ofregression analysis, such combinations are known as interaction features. The (implicit) feature space of a polynomial kernel is equivalent to that ofpolynomial regression, but without the combinatorial blowup in the number of parameters to be learned. When the input features are binary-valued (booleans), then the features correspond tological conjunctions of input features.[1]
For degree-d polynomials, the polynomial kernel is defined as[2]
wherex andy are vectors of sizen in theinput space, i.e. vectors of features computed from training or test samples andc ≥ 0 is a free parameter trading off the influence of higher-order versus lower-order terms in the polynomial. Whenc = 0, the kernel is called homogeneous.[3] (A further generalized polykernel dividesxTy by a user-specified scalar parametera.[4])
As a kernel,K corresponds to an inner product in a feature space based on some mappingφ:
The nature ofφ can be seen from an example. Letd = 2, so we get the special case of the quadratic kernel. After using themultinomial theorem (twice—the outermost application is thebinomial theorem) and regrouping,
From this it follows that the feature map is given by:
Although theRBF kernel is more popular in SVM classification than the polynomial kernel, the latter is quite popular innatural language processing (NLP).[1][5]The most common degree isd = 2 (quadratic), since larger degrees tend tooverfit on NLP problems.
Various ways of computing the polynomial kernel (both exact and approximate) have been devised as alternatives to the usual non-linear SVM training algorithms, including:
full expansion of the kernel prior to training/testing with a linear SVM,[5] i.e. full computation of the mappingφ as in polynomial regression;
basket mining (using a variant of theapriori algorithm) for the most commonly occurring feature conjunctions in a training set to produce an approximate expansion;[6]
One problem with the polynomial kernel is that it may suffer fromnumerical instability: whenxTy +c < 1,K(x,y) = (xTy +c)d tends to zero with increasingd, whereas whenxTy +c > 1,K(x,y) tends to infinity.[4]
^abcYoav Goldberg and Michael Elhadad (2008). splitSVM: Fast, Space-Efficient, non-Heuristic, Polynomial Kernel Computation for NLP Applications. Proc. ACL-08: HLT.