Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Not every similarity is a kernel
You could invent any “similarity score” between data points, but only some of them behave like real geometry: like measuring angles and lengths in some (possibly enormous) space. Those are kernels. The test is simple to state: write all pairwise similarities in a table (the Gram matrix). If the table never says that some combination of points has a negative squared length, the similarity is a legitimate kernel.
Using a function that isn’t positive definite in an SVM or a Gaussian process breaks the optimization (the problem stops being convex) or produces negative variances, which means nonsense uncertainty for a robot’s terrain model. Knowing the rules also lets you design kernels that encode physics: periodicity for orbits, smoothness for trajectories.
- 1. A valid kernel's Gram matrix has…
- 2. Is every similarity score a kernel?
- 3. A kernel corresponds to an inner product in…
Level 1: Beginner
★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.Definition
A symmetric function k is positive (semi)definite if, for every finite set and every vector ,
so every Gram matrix is PSD. Feature-map kernels qualify: the sum equals .
Quick tests
- The diagonal must be non-negative: .
- Cauchy–Schwarz: .
- For two points, is PSD exactly when |a| ≤ 1.
The plain distance |x − z| fails at once: its 2×2 Gram matrix has zero diagonal and eigenvalues ±|x − z|.
- 1. Eigenvalues of [[0, 3], [3, 0]]:
- 2. If k(x, x) = 4 and k(z, z) = 9, then |k(x, z)| is at most…
- 3. Feature-map kernels are PSD because Σcᵢcⱼk(xᵢ, xⱼ) equals…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Closure rules
If are kernels, a ≥ 0, f is any function and p is a polynomial with non-negative coefficients, then these are kernels:
- (sum)
- (product, by the Schur product theorem)
- (rescaling)
- and (limits of sums and products)
- (normalization)
Example: is a rescaled , so the RBF is a kernel.
Classic non-kernels
- : the “sigmoid kernel” of early SVMs. It is PSD only for some parameters and data.
- and .
- with p greater than 2.
- 1. The product of two kernels is a kernel by…
- 2. exp(x·z) is a kernel because…
- 3. The sigmoid tanh(a x·z + c) is…
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Mercer’s theorem
Let k be a continuous PSD kernel on a compact set with a measure p. The integral operator is compact, self-adjoint and positive. Its eigenpairs , with and the orthonormal in , give
converging absolutely and uniformly. So is an explicit feature map, and .
Examples
- Brownian motion on [0, 1]: , . Polynomial decay: rough sample paths.
- RBF with Gaussian p: geometric decay . Smooth functions, low effective dimension.
Nyström
Sampling , the eigenvalues of K/m approximate the , and times the eigenvectors approximate at the samples.
- 1. Mercer's eigenvalues sum to…
- 2. Faster eigenvalue decay means…
- 3. The Nyström estimate of λⱼ is…
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.Mercer, measured
Exercise 1. The smallest/largest eigenvalue ratios are: RBF ≈ 1e-10, cubic polynomial ≈ 0 (it has rank 10 in 2-D), Laplace 0.008, RBF × quadratic ≈ 1e-9, exp(x·z) ≈ 5e-12. All are PSD up to round-off. The sigmoid (−0.74), distance (−0.31) and negative distance (−1) fail clearly.
Exercise 2. With 800 samples, Nyström gives λ₁ = 0.422 for Brownian motion (exact 4/π² = 0.405), and its top eigenvector matches √2 sin(πx/2) with correlation above 0.999. For the RBF kernel (ℓ = σ = 1), the estimates 0.630, 0.233, 0.086 and 0.031 track the exact 0.618, 0.236, 0.090 and 0.034, a geometric series with ratio (3 − √5)/2 ≈ 0.382. The top 10 eigenvalues capture all but 7 × 10⁻⁵ of the RBF trace, but miss 2% of the Brownian trace. Smooth kernels are effectively low-rank, which is why Nyström and random-feature approximations work so well for them.
Kernel design in AI, robotics and aerospace
- GP kernels with physics: periodic kernels for orbital or gait data, sums for multi-scale signals, products for interactions.
- Kernel validity checks before deploying GP-based safe-control (barrier) methods.
- Spectral truncation for fast GP inference on embedded hardware.
- Graph and string kernels for structured data such as molecular graphs and command sequences.
References
- J. Mercer (1909). “Functions of positive and negative type, and their connection with the theory of integral equations.” Philosophical Transactions of the Royal Society A, 209.
- C. E. Rasmussen, C. K. I. Williams (2006). Gaussian Processes for Machine Learning. MIT Press (ch. 4).
- B. Schölkopf, A. J. Smola (2002). Learning with Kernels. MIT Press (ch. 2).
- C. K. I. Williams, M. Seeger (2001). “Using the Nyström method to speed up kernel machines.” NeurIPS.
- I. Steinwart, A. Christmann (2008). Support Vector Machines. Springer (ch. 4).