Lably
Skip to content

Polynomial kernel

Machine learning kernel function

  • 2 min read
  • 2 chapters

Related on Lably

Through Machine learning, Regression analysis and Logical conjunction

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 of regression analysis, such combinations are known as interaction features. The (implicit) feature space of a polynomial kernel is equivalent to that of polynomial 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 to logical conjunctions of input features.

Definition

For degree-d polynomials, the polynomial kernel is defined as

K(x,y)=(xTy+c)d

where x and y are vectors of size n in the input space, i.e. vectors of features computed from training or test samples and c ≥ 0 is a free parameter trading off the influence of higher-order versus lower-order terms in the polynomial. When c = 0, the kernel is called homogeneous. (A further generalized polykernel divides xTy by a user-specified scalar parameter a.)

As a kernel, K corresponds to an inner product in a feature space based on some mapping φ:

K(x,y)=⟨φ(x),φ(y)⟩

The nature of φ can be seen from an example. Let d = 2, so we get the special case of the quadratic kernel. After using the multinomial theorem (twice—the outermost application is the binomial theorem) and regrouping,

K(x,y)=(∑i=1nxiyi+c)2=∑i=1n(xi2)(yi2)+∑i=2n∑j=1i−1(2xixj)(2yiyj)+∑i=1n(2cxi)(2cyi)+c2

From this it follows that the feature map is given by:

φ(x)=(xn2,…,x12,2xnxn−1,…,2xnx1,2xn−1xn−2,…,2xn−1x1,…,2x2x1,2cxn,…,2cx1,c)

generalizing for (xTy+c)d, where x∈Rn, y∈Rn and applying the multinomial theorem:

(xTy+c)d=∑j1+j2+⋯+jn+1=dd!j1!⋯jn!jn+1!x1j1⋯xnjncjn+1d!j1!⋯jn!jn+1!y1j1⋯ynjncjn+1=φ(x)Tφ(y)

The last summation has ld=(n+dd) elements, so that:

φ(x)=(a1,…,al,…,ald)

where l=(j1,j2,...,jn,jn+1) and

al=d!j1!⋯jn!jn+1!x1j1⋯xnjncjn+1|j1+j2+⋯+jn+jn+1=d

Sign in to keep reading

One more chapter is free with a Lably account.

More in Computing and communication