Skip to content
Oakfield Operator Calculus Function Reference Site

Random Fourier Feature Expansions

Random Fourier features map inputs through randomized sinusoids whose frequencies are drawn from a kernel-dependent distribution, enabling finite-dimensional approximations of shift-invariant kernels.

ϕ(x)=2m[cos(ωix+bi)]i=1m\phi(x) = \sqrt{\tfrac{2}{m}}[\cos(\omega_i^\top x + b_i)]_{i=1}^m

Inputs are vectors in the kernel domain; outputs are feature vectors used for linear models.


ωip(ω),k(x,x)ϕ(x)ϕ(x)\omega_i \sim p(\omega), \qquad k(x,x') \approx \phi(x)^\top \phi(x')

Under the Fourier convention k^(ω)=Rdk(δ)eiωδdδ\hat{k}(\omega)=\int_{\mathbb{R}^d} k(\delta)\,e^{-i\omega^\top\delta}\,d\delta, the normalized sampling density is

p(ω)=1(2π)dk^(ω)k(0)p(\omega)=\frac{1}{(2\pi)^d}\frac{\hat{k}(\omega)}{k(0)}

(so that p(ω)dω=1\int p(\omega)\,d\omega=1), and expectations over ωi\omega_i and bib_i recover the target shift-invariant kernel. The estimator’s mean-square error scales like O(1/m)\mathcal{O}(1/m) (so typical error scales like O(1/m)\mathcal{O}(1/\sqrt{m})).

In the common cosine-with-random-phase construction above, one takes biU(0,2π)b_i\sim U(0,2\pi) independently of ωi\omega_i.


For the Gaussian/RBF kernel k(δ)=exp(δ2/(22))k(\delta)=\exp(-\|\delta\|^2/(2\ell^2)) (so k(0)=1k(0)=1), one has ωiN(0,2I)\omega_i \sim \mathcal{N}(0, \ell^{-2} I). As mm \to \infty, Monte Carlo error vanishes almost surely; for m=1m=1, the feature collapses to a single random sinusoid capturing one spectral component.


  • Gaussian/RBF kernels use Gaussian spectral sampling for ωi\omega_i.
  • Increasing mm reduces Monte Carlo error at rate O(1/m)\mathcal{O}(1/\sqrt{m}).

Fourier transforms connect p(ω)p(\omega) to the target kernel; Gaussian functions set the spectral density for RBF kernels; chirps and complex exponentials provide the underlying sinusoidal components.


Oakfield uses random Fourier feature expansions as a stimulus family:

  • stimulus_random_fourier operator synthesizes structured fields from a sum of random Fourier features with configurable band limits (k_min/k_max), feature count, spectral slope, and seed.
  • Used to generate controlled random spatial structure (often as a “textured” forcing/initial condition) rather than as a learned-kernel approximation layer.

📜 Bochner’s Theorem and Random Features

Section titled “📜 Bochner’s Theorem and Random Features”

Random Fourier features are motivated by Bochner’s theorem, which represents shift-invariant positive-definite kernels via spectral measures.

They provide practical finite-dimensional surrogates for kernel methods, trading deterministic accuracy for randomized scalability.


  • Rahimi & Recht, “Random Features for Large-Scale Kernel Machines” (2007)
  • Stein & Shakarchi, Fourier Analysis