Kernels, RKHS and the Representer Theorem
Positive definite kernels, the reproducing property, a complete proof of the representer theorem, and kernel ridge regression.
Positive definite kernels
is a positive definite kernel if it is symmetric, , and for every finite the Gram matrix is positive semidefinite.
is a positive definite kernel if and only if there is a Hilbert space and a map with
Let be a positive definite kernel on . There is a unique Hilbert space of real-valued functions on such that
- for every ;
- is dense in ;
- reproducing property: for every and .
Key idea
The two halves of the reproducing property are worth separating. It says (a) evaluation at is a continuous linear functional on — which is the defining property of an RKHS and is false in, say, , where pointwise values are not even defined; and (b) that functional is represented by . Everything computational about kernels follows from (b), and everything about well-posedness of pointwise learning follows from (a).
The representer theorem
Let be the RKHS of , let be strictly increasing, and let be arbitrary. Then any minimiser of
over admits a representation
Key idea
An infinite-dimensional optimisation problem has been reduced to real numbers, and the reduction is exact, not an approximation. Note precisely what made it work: the loss depends on only through its values at the data points, and the penalty is a strictly increasing function of the norm. Both hypotheses are essential — a penalty like that is not a function of , or a loss involving at unseen points, breaks the conclusion.
For the squared loss with regularisation ,
Building kernels
Let be positive definite kernels on , , , and . Then the following are positive definite:
The Gaussian kernel is positive definite
Expand the exponent.
is PD (it is an inner product of features, namely ), and of a PD kernel is PD.
The middle factor is the exponential of the linear kernel, hence PD by the closure proposition.
With , is a product of two PD kernels.
The outer factors form a rank-one kernel f(x)f(x'), which is PD, and the product of PD kernels is PD.
Standard kernels and the feature spaces they correspond to:
| Kernel | Formula | Feature space |
|---|---|---|
| Linear | itself | |
| Polynomial | all monomials of degree , dimension | |
| Gaussian (RBF) | infinite-dimensional | |
| Laplace | infinite-dimensional | |
| Cosine similarity | normalised |
The cost
Forming requires kernel evaluations and storage; solving by Cholesky costs flops. Prediction at a new point costs kernel evaluations.
What this does not say
This is the reason kernel methods are not used at the scale deep learning operates at: makes entries impossible. The standard remedies are
- Nyström approximation: sample landmarks and approximate , reducing cost to .
- Random features (Rahimi–Recht): for a shift-invariant kernel, by Bochner's theorem, so sampling frequencies gives an explicit -dimensional feature map with cost.
- Structured kernels with fast transforms.
None of these changes the statistical guarantees materially for moderate , and all of them make the method a finite-dimensional linear model again — which is worth noticing, because the same observation connects kernels to the neural tangent kernel picture on the deep learning theory page.
Problems
The Gaussian kernel is positive definiteProof · Intermediate · 30 min Prove the representer theoremProof · Graduate · 1 hour The reproducing property and its consequencesProof · Advanced · 30 min Kernel ridge regression in closed formProof · Intermediate · 30 min Implement kernel ridge regressionCoding · Intermediate · 1 hour The Schur product theoremProof · Advanced · 30 minReferences
- BookBernhard Schölkopf and Alexander J. Smola (2002). Learning with Kernels
- PaperNachman Aronszajn (1950). Theory of Reproducing Kernels
- BookIngo Steinwart and Andreas Christmann (2008). Support Vector MachinesThe most careful modern treatment of RKHS theory for learning.
- PaperAli Rahimi and Benjamin Recht (2007). Random Features for Large-Scale Kernel Machines
These works are cited as sources to read, not reproduced. All exposition, examples and problems on this site are written independently; where an argument is standard, the citation points to a canonical treatment.
Results stated on this page
- DefinitionPositive definite kernelA symmetric function whose Gram matrices are all PSD.
- TheoremA kernel is positive definite iff it is an inner product of featuresproof includedPositive definiteness is exactly the condition for a feature-map representation to exist.
- TheoremConstruction of the reproducing kernel Hilbert spaceproof includedEvery positive definite kernel has a unique Hilbert space of functions in which it reproduces evaluation.
- TheoremRepresenter theoremproof includedAny regularised empirical risk minimiser over an RKHS lies in the span of the kernel sections at the data points.
- PropositionKernel ridge regression in closed formproof includedThe coefficients solve an n-by-n linear system involving only the kernel matrix.
- PropositionOperations that preserve positive definitenessproof includedSums, products, scalings, limits and compositions with power series of PD kernels are PD.
- PropositionKernel methods cost O(n^2) memory and O(n^3) timeproof includedThe exact solution requires forming and factorising the kernel matrix, which is why approximations exist.
Experiments
Problems (6)
All problems- The Gaussian kernel is positive definiteProofIntermediate⏱ 30 min
- Implement kernel ridge regressionCodingIntermediate⏱ 1 hour
- Kernel ridge regression in closed formProofIntermediate⏱ 30 min
- Prove the representer theoremProofGraduate⏱ 1 hour
- The reproducing property and its consequencesProofAdvanced⏱ 30 min
- The Schur product theoremProofAdvanced⏱ 30 min