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.
Laplace kernel Created 2026-09-28 Updated 2026-11-05
For , the Laplace kernel on is
For , take independent random variables with Cauchy distribution of scale . Their characteristic functions give
Each sampled frequency has a two-coordinate feature map . Its inner product gives the cosine of the difference, so averaging proves the positive-semidefinite kernel property and yields Random Fourier features. At , the Laplace kernel is the constant-one positive-semidefinite kernel. Negative would violate the two-point Cauchy-Schwarz inequality for positive-semidefinite kernels.
Random Fourier features Created 2026-09-28 Updated 2026-11-05
Random Fourier features approximate a continuous translation-invariant positive-semidefinite kernel on with . Its spectral probability distribution gives frequencies satisfying .
Draw independent and identically distributed random variables from this distribution and independent from the continuous uniform distribution on . Define the feature map
Averaging the product of two cosines over leaves one half of , so . Every realized approximate kernel matrix is positive semidefinite because it is a Gram matrix. Increasing averages more sampled features; it does not make the finite approximation identically equal to the original positive-semidefinite kernel.[ref]
For a positive-semidefinite kernel with positive diagonal constant , normalize by and multiply by . The identically zero case needs no random features.