Canonical feature space of a positive-semidefinite kernel Created 2026-10-06 Updated 2026-10-14
On the finite formal span of symbols , define and extend bilinearly. For a positive-semidefinite kernel, the null vectors of this positive semidefinite bilinear form form its radical of a bilinear form. Quotienting by that linear subspace gives an inner product space and feature map with . This construction works for degenerate and zero kernels.
Computational tradeoffs of the kernel trick 2026-10-14
For input coordinates, the homogeneous quadratic polynomial kernel has a weighted quadratic feature map with distinct monomials. Computing an inner product of already stored mapped vectors costs arithmetic operations, whereas costs using the input vectors. Here denotes big O notation. Higher fixed degrees can make the dimension gap much larger.
Sample count still matters. With training examples, materializing a dense kernel matrix stores numbers and requires distinct evaluations using symmetry. A dense direct solve for kernel ridge regression typically takes operations after constructing the kernel matrix, while a dual prediction with nonzero coefficients uses kernel evaluations. Explicit finite feature maps can be preferable when is small relative to , and a stored primal weight vector can make prediction depend on rather than on . The kernel trick by Ryan Giordano (sections Ridge regression and The polynomial kernel) explains the change from feature-coordinate equations to training-example equations; neither representation is universally faster.
The kernel trick saves explicit feature construction when the positive-semidefinite kernel is economical to evaluate; it does not remove the cost of optimization, choose a useful positive-semidefinite kernel, or establish generalization. Random Fourier features illustrate a different tradeoff: replacing the exact Gaussian kernel with a finite approximate feature map can reduce dependence on the sample count while introducing approximation error.
Dual prediction with a kernel 2026-10-14
If the weight vector lies in the linear span of the training feature map outputs, write . ThenThis is a dual representation: coefficients weight training examples rather than feature coordinates. They need not be positive, and need not be unique when the kernel matrix is singular. Some kernel methods instead write with under their own optimization constraints.[ref]
The kernel trick by Ryan Giordano. Kernelizing classification with support vector machines: displayed prediction as a sum of label-weighted kernel evaluations
The formula is an algebraic conversion for a weight vector in this linear span, not a claim about every possible weight vector. The representer theorem gives a broader reason this form appears in regularized kernel methods.For the XOR separation by a product feature, let have rows . The Gram matrix of those rows, equivalently the kernel matrix, isIts eigenvalues are , so it is a positive semidefinite matrix of rank two, not an invertible matrix. More generally, for any real coefficient vector and any finite set of inputs,This proves the positive-semidefinite kernel condition for the displayed polynomial kernel on all of , rather than checking only this square.
Here , so the explicit choice gives and . ConsequentlyFor the new input , the four polynomial kernel evaluations are . Their weighted sum is , and the sign function predicts . No explicit feature map is needed for this calculation. These coefficients were constructed to reproduce the chosen separator; no fitting algorithm or generalization guarantee is being asserted.
Gaussian kernel 2026-09-24
The Gaussian kernel is a translation-invariant positive-semidefinite kernel whose canonical feature map takes values in an infinite-dimensional vector space.
Kernel method 2026-09-24
A kernel method represents data through a positive-semidefinite kernel, allowing algorithms to use inner products in an implicit feature map.
Kernel trick Created 2026-09-24 Updated 2026-10-14
The kernel trick evaluates inner products of feature map outputs through without explicitly constructing those vectors. An algorithm expressed entirely through these inner products can therefore operate on nonlinear derived coordinates using only evaluations of a positive-semidefinite kernel on the original inputs. A classifier linear in the derived coordinates can have a nonlinear boundary in the original coordinates.
The polynomial kernel gives a finite, fully visible example: corresponds to . The XOR separation by a product feature below makes the interaction coordinate useful, while dual prediction with a kernel shows how to predict without calculating it explicitly.
An arbitrary score called a similarity need not be a positive-semidefinite kernel. Symmetry alone, even with nonnegative entries, is insufficient: the symmetric matrixhas for , so it cannot be a Gram matrix of real inner products. A positive-semidefinite kernel requires a positive semidefinite matrix for every finite choice of inputs, not just the observed training data.[ref]
Gaussian Processes for Machine Learning by Carl Edward Rasmussen and Christopher K. I. Williams. Section 4.1, p. 80: Gram matrices, quadratic-form definition of positive semidefiniteness, and nonnegative eigenvalues
The existing Moore-Aronszajn theorem connects this requirement to a Reproducing kernel Hilbert space; this example needs only finite linear algebra. Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 205 2 Solution Created 2026-10-03 Updated 2026-10-14
Use the normalizationThis is ridge regression; the penalty is the squared Euclidean norm. The centering removes the need for an intercept. Differentiating gives the normal equationFor every nonzero , . The coefficient matrix is therefore a positive-definite matrix, even if the design matrix has deficient matrix rank. The objective is a strictly convex function, so the unique minimizer is the closed-form ridge regression estimator, with fitted values
For the primal-dual identity for ridge regression, put and observeBoth parenthesized matrices are positive-definite matrices. Multiplying by their inverses givesThus the same fitted vector has the dual expressionNo inverse of or alone was needed. This is also the kernel-ridge hat matrix for the linear kernel.
Here a positive-definite kernel means a symmetric real-valued function whose every finite kernel matrix is positive semidefinite: for all , and ,This is the usual positive-semidefinite kernel convention; strict positivity for distinct points is not required. In particular . Write , and . Positivity of the two-point kernel matrix impliesIf , substitute to obtain . If , the affine expression can be nonnegative for every only if . Both cases give the Cauchy-Schwarz inequality for positive-semidefinite kernels:The zero-diagonal case is essential when the positive-definite kernel is not strictly positive.
To construct a feature map, let be the real vector space of finite formal linear combinations of symbols , one for each . Define a symmetric bilinear form byThe positive-definite kernel property makes this a positive semidefinite bilinear form. It need not yet be an inner product: distinct formal vectors can have zero squared length. The same quadratic-polynomial argument, now applied to , provesTherefore implies for every . The setis the radical of a bilinear form, hence a linear subspace. SetThe quotient vector space has a well-defined inner product: changing representatives by elements of changes no pairing, and a zero-length class is exactly the zero class. It is therefore an inner product space.
Define . By construction,Every positive-definite kernel thus has a feature representation, including degenerate kernels and the zero kernel. This is its canonical feature space of a positive-semidefinite kernel. The construction already gives the requested inner product space.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 218 2 a Solution Created 2026-10-03 Updated 2026-10-05
In the terminology used for positive-definite kernels, positive definiteness means positive semidefiniteness of every finite kernel matrix: is symmetric and, for every , points and real ,The linear kernel is symmetric, andThus it is a positive-semidefinite kernel, with the identity as its feature map. It need not be strictly positive definite: a zero vector or linearly dependent points can make this quadratic form zero for nonzero . This distinction is essential when interpreting the terminology.
Past exam of the mathematics course of the University of Cambridge 2019 iii Paper 205 3 1 Solution Created 2026-10-03 Updated 2026-10-14
A positive-semidefinite kernel on is a symmetric function such that, for every and ,If for a feature map into an inner product space, thenThus every feature-map inner product is a kernel. If , then each finite quadratic form for is the corresponding nonnegative linear combination, so nonnegative linear combinations of kernels are kernels.
Past exam of the mathematics course of the University of Cambridge 2024 iii Paper 205 1 b Solution Created 2026-09-24 Updated 2026-09-25
Suppose a feature map represented the Gaussian kernel. Choose , a unit vector , and points for . Their kernel matrix isFor sufficiently large , hence sufficiently small , every row satisfiesThus is a symmetric strictly diagonally dominant matrix with positive diagonal and is therefore a positive-definite matrix, so .
On the other hand, if is the matrix whose th row is , then and , a contradiction. Hence every feature-space realization of the Gaussian kernel requires an infinite-dimensional vector space.
Past exam of the mathematics course of the University of Cambridge 2024 iii Paper 205 1 d Solution Created 2026-09-24 Updated 2026-09-25
PutThe numerator is the linear kernel, while the reciprocal of the denominator is the kernel from part c applied to and . The product of positive-semidefinite kernels therefore shows that is a positive-semidefinite kernel. The Cauchy-Schwarz inequality and the arithmetic-geometric mean inequality give , soEach power is positive semidefinite by the Schur product theorem, and the convergent sum is positive semidefinite.
Moreover . If is its canonical feature map, thenThe feature-space norm gives symmetry and the triangle inequality. Finally, implies , hence andwhich is equivalent to . Thus is a metric rather than merely a pseudometric.
Polynomial kernel 2026-10-14
For , a polynomial kernel is the positive-semidefinite kernel , where is a positive integer and . The case uses monomials of total degree ; also includes lower degrees. The feature map weights matter: listing each distinct monomial once with coefficient one generally gives a different inner product.[ref]
Gaussian Processes for Machine Learning by Carl Edward Rasmussen and Christopher K. I. Williams. Section 4.2.2, pp. 89–90, equations (4.23)–(4.24): polynomial kernels and weighted monomial features
For the homogeneous quadratic case in two dimensions, take the scaled quadratic feature mapThe inner product identity is explicit:The factor accounts for the two equal cross terms in the square. Thus an inner product of three derived coordinates can be obtained from an inner product of the two input coordinates followed by squaring. The kernel trick uses this equality inside an algorithm; the feature map explains which nonlinear functions the algorithm can represent.
Random Fourier features Created 2026-09-28 Updated 2026-10-03
Random Fourier features represent a translation-invariant positive-semidefinite kernel by sampling frequencies from its spectral distribution and using sine and cosine features. They replace an implicit infinite-dimensional feature map by a finite random approximation.
XOR separation by a product feature 2026-10-14
Give the four corners of the square the exclusive or labels: when the input signs differ and when they agree. In the following order,No affine function has the required strictly positive scores at and strictly negative scores at : both pairs have midpoint zero, so would have to be both positive and negative. This also rules out perfect classification by a single threshold with a consistent tie rule.
Under the polynomial kernel's quadratic feature map, the two classes become two distinct vectors:The hyperplane separates them. With and , the score and classifier areAll four signed scores equal one. In the input plane the boundary is , the union of the coordinate axes; in the derived coordinates it is a single hyperplane. The feature map identifies opposite corners, which is harmless for these labels because opposite corners belong to the same class. A fixed feature map would not separate labels that disagree at identical mapped vectors.
XOR labels in the input square and the quadratic feature slice
. The dashed diagonals join equal-label input pairs and share their midpoint, obstructing affine separation. In the feature panel all mapped points have third coordinate one; the two coincident pairs are separated by the horizontal hyperplane at second coordinate zero. Details.
