Post · 25 min read· pp. 155–166

Polynomial magic III : Hermite polynomials

After two blog posts earlier this year on Chebyshev and Jacobi polynomials, I am coming back to orthogonal polynomials, with Hermite polynomials.

This time, in terms of applications to machine learning, no acceleration, but some interesting closed-form expansions in positive-definite kernel methods.

Definition and first properties

There are many equivalent ways to define Hermite polynomials. A natural one is through the so-called Rodrigues’ formula:

Hk(x)=(−1)kex2dkdxk[e−x2],H_k(x) = (-1)^k e^{x^2} \frac{d^k}{d x^k}\big[ e^{-x^2} \big],
from which we can deduce H0(x)=1H_0(x) = 1, H1(x)= –ex2[−2xe−x2]=2xH_1(x) =\ – e^{x^2} \big[ -2x e^{-x^2} \big] = 2x, H2(x)=ex2[(−2x)2e−x2−2e−x2]=4x2–2H_2(x) = e^{x^2} \big[ (-2x)^2e^{-x^2} -2 e^{-x^2} \big] = 4x^2 – 2, etc.

Other simple properties which are consequences of the definition (and can be shown by recursion) are that HkH_k is a polynomial of degree kk, with the same parity as kk, and with a leading coefficient equal to 2k2^k.

Orthogonality for Gaussian distribution. Using integration by parts, one can show (see end of the post) that for k≠ℓk \neq \ell, we have

∫−∞+∞ ⁣ ⁣ ⁣Hk(x)Hℓ(x)e−x2dx=0,\int_{-\infty}^{+\infty} \!\!\!H_k(x) H_\ell(x) e^{-x^2} dx =0,
and that for k=ℓk=\ell, we have
∫−∞+∞ ⁣ ⁣ ⁣Hk(x)2e−x2dx=π2kk!.\int_{-\infty}^{+\infty} \!\!\! H_k(x)^2 e^{-x^2}dx = \sqrt{\pi} 2^k k!.

In other words, the Hermite polynomials are orthogonal for the Gaussian distribution with mean 00 and variance 12\frac{1}{2}. Yet in other words, defining the Hermite functions as ψk(x)=(π2kk!)−1/2Hk(x)e−x2/2\displaystyle \psi_k(x) = (\sqrt{\pi} 2^k k!)^{-1/2} H_k(x) e^{-x^2/2}, we obtain an orthonormal basis of L2(dx)L_2(dx). As illustrated below, the Hermite functions, as the index kk increases, have an increasing “support” (the support is always the entire real line, but most of the mass is concentrated in centered balls of increasing sizes, essentially at k\sqrt{k}) and, like cosines and sines, an increasingly oscillatory behavior.

Plot of Hermite functions ψk(x)=(π2kk!)−1/2Hk(x)e−x2/2\psi_k(x) = (\sqrt{\pi} 2^k k!)^{-1/2} H_k(x) e^{-x^2/2}, from k=0k=0 to k=20k=20.

Among such orthonormal bases, the Hermite functions happen to be diagonalizing the Fourier tranform operator. In other words, the Fourier transform of ψk\psi_k (for the definition making it an isometry of L2(dx)L_2(dx)) is equal to

F(ψk)(ω) =12π∫−∞+∞ψk(x)e−iωxdx=(−i)kψk(ω).\mathcal{F}(\psi_k)(\omega)  = \frac{1}{\sqrt{2\pi}} \int_{-\infty}^{+\infty} \psi_k(x) e^{- i \omega x} dx = (-i)^k \psi_k(\omega).
(note that the eigenvalues are all of unit modulus as we have an isometry). See a proof at the end of the post. I am not aware of any applications of this property in machine learning or statistics (but there are probably some).

Recurrence. In order to compute Hermite polynomials, the following recurrence relation is the most useful

Hk+1(x)=2xHk(x) –2kHk−1(x).(1)H_{k+1}(x) = 2x H_k(x) \ – 2k H_{k-1}(x). \tag{1}
Such recursions are always available for orthogonal polynomials (see [4]), but it takes here a particularly simple form (see a proof at the end of the post).

Generating function. The following property is central in many proofs of properties of Hermite polynomials: for all t∈Rt \in \mathbb{R}, we have

∑k=0∞tkk!Hk(x)=e2xt – t2,(2)\sum_{k=0}^\infty \frac{t^k}{k!} H_k(x) =e^{ 2xt \ – \ t^2}, \tag{2}
with a proof at the end of the post based on the residue theorem.

Further (less standard) properties

For the later developments, we need other properties which are less standard (there are many other interesting properties, which are not useful for this post, see here).

Mehler formula. For ∣ρ∣<1|\rho| < 1, it states:

exp⁡(–ρ1−ρ2(x−y)2)=1−ρ2∑k=0∞ρk2kk!Hk(x)Hk(y)exp⁡(–ρ1+ρ(x2+y2)).\exp \Big( – \frac{\rho}{1- \rho^2} (x-y)^2\Big) = \sqrt{1-\rho^2} \sum_{k=0}^\infty \frac{\rho^k}{2^k k!} H_k(x) H_k(y) \exp \Big( – \frac{\rho}{1+\rho} (x^2 + y^2) \Big).
The proof is significantly more involved; see [1] for details (with a great last sentence: “Prof. Hardy tells me that he has not seen his proof in print, though the inevitability of the successive steps makes him think that it is unlikely to be new”). Note that we will in fact obtain a new proof from the relationship with kernel methods (see below).

Expectation for Gaussian distributions. We will need this property for ∣ρ∣<1|\rho|<1 (see proof at the end of the post), which corresponds to the expectation of Hk(x)H_k(x) for xx distributed as a non-centered Gaussian distribution:

∫−∞∞Hk(x)exp⁡(–(x−ρy)21−ρ2)dx=πρk1−ρ2Hk(y).(3)\int_{-\infty}^\infty H_k(x) \exp\Big( – \frac{(x-\rho y)^2}{1-\rho^2} \Big)dx= \sqrt{\pi} \rho^k \sqrt{1-\rho^2} H_k (y). \tag{3}

Given the relationship with the Gaussian distribution, it is no surprise that Hermite polynomials pop up whenever Gaussians are used, as distributions or kernels. Before looking into it, let’s first give a brief review of kernel methods.

From positive-definite kernel to Hilbert spaces

Given a prediction problem with inputs in a set X\mathcal{X}, a traditional way of parameterizing real-valued functions on X\mathcal{X} is to use positive-definite kernels.

A positive-definite kernel is a function K:X×X→RK: \mathcal{X} \times \mathcal{X} \to \mathbb{R} such that for all sets {x1,…,xn}\{x_1,\dots,x_n\} of nn elements of X\mathcal{X}, the “kernel matrix” in Rn×n\mathbb{R}^{n \times n} composed of pairwise evaluations is symmetric positive semi-definite. This property happens to be equivalent to the existence of a Hilbert feature space H\mathcal{H} and a feature map φ:X→H\varphi: \mathcal{X} \to \mathcal{H} such that

K(x,x’)=⟨φ(x),φ(x’)⟩H,K(x,x’) = \langle \varphi(x), \varphi(x’) \rangle_{\mathcal{H}},
with an elegant constructive proof [15].

This allows to define the space of linear functions on the features, that is, functions of the form

f(x)=⟨f,φ(x)⟩H,f(x) = \langle f, \varphi(x) \rangle_{\mathcal{H}},
for f∈Hf \in \mathcal{H}.

This space is often called the reproducing kernel Hilbert space (RKHS) associated to the kernel KK (we can prove that it is indeed uniquely defined). In such a space, we can also define the squared norm of the function ff, namely ∥f∥H2\| f\|_{\mathcal{H}}^2, which can be seen as a specific regularization term in kernel methods.

The space satisfies the so-called reproducing property (hence its name): f(x)=⟨f,K(⋅,x)⟩Hf(x) = \langle f, K(\cdot,x) \rangle_{\mathcal{H}}. In other words, the feature φ(x)\varphi(x) is the kernel function evaluated at xx, that is, φ(x)=K(⋅,x)\varphi(x) = K(\cdot,x). These spaces have been a source of many developments in statistics [5] and machine learning [6, 7].

Orthonormal basis. A difficulty in working with infinite-dimensional Hilbert spaces of functions is that it is sometimes hard to understand what functions are actually considered. One simple way to enhance understanding of the regularization property is to have an orthonormal basis (in very much the same way as the Fourier basis), as we can then identify H\mathcal{H} to the space of squared-integrable sequences.

For kernel-based Hilbert spaces, if we have an orthonormal basis (gk)k⩾0(g_k)_{k \geqslant 0} of the Hilbert space H\mathcal{H}, then, by decomposing φ(x)\varphi(x) in the basis, we have

φ(x)=∑k=0∞⟨φ(x),gk⟩Hgk,\varphi(x) = \sum_{k =0}^\infty \langle \varphi(x), g_k \rangle_\mathcal{H} g_k,
we get
K(x,y)=⟨φ(y),φ(x)⟩=∑k=0∞⟨φ(x),gk⟩H⟨φ(y),gk⟩H=∑k=0∞gk(x)gk(y),(4)K(x,y) = \langle \varphi(y), \varphi(x) \rangle = \sum_{k =0}^\infty \langle \varphi(x), g_k \rangle_\mathcal{H} \langle \varphi(y), g_k \rangle_\mathcal{H} =\sum_{k=0}^\infty g_k(x) g_k(y), \tag{4}
that is, we have an expansion of the kernel as an infinite sum (note here, that we ignore summability issues).

Among orthonormal bases, some are more interesting than others. The ones composed of eigenfunctions for particular operators are really more interesting, in particular for the covariance operator that we now present, and their use in statistical learning theory.

Analyzing ridge regression through covariance operators

The most classical problem where regularization by RKHS norms occurs is ridge regression, where, given some observations (x1,y1),…,(xn,yn)∈X×R(x_1,y_1),\dots,(x_n,y_n) \in \mathcal{X} \times \mathbb{R}, one minimizes with respect to f∈Hf \in \mathcal{H}:

1n∑i=1n(yi –⟨f,φ(xi)⟩H)2+λ∥f∥H2.\frac{1}{n} \sum_{i=1}^n \big( y_i \ – \langle f, \varphi(x_i) \rangle_{\mathcal{H}} \big)^2 + \lambda \| f\|_{\mathcal{H}}^2.

In finite dimensions, the convergence properties are characterized by the (non-centered) covariance matrix Σ=E[φ(x)⊗φ(x)]\Sigma = \mathbb{E} \big[ \varphi(x) \otimes \varphi(x) \big], where the expectation is taken with respect to the underlying distribution of the observations x1,…,xnx_1,\dots,x_n (which are assumed independently and identically distributed for simplicity). If H=Rd\mathcal{H} = \mathbb{R}^d, then Σ\Sigma is a d×dd \times d matrix.

For infinite-dimensional H\mathcal{H}, the same expression Σ=E[φ(x)⊗φ(x)]\Sigma = \mathbb{E} \big[ \varphi(x) \otimes \varphi(x) \big] defines a linear operator from H\mathcal{H} to H\mathcal{H}, so that for f,g∈Hf,g \in \mathcal{H}, we have

⟨f,Σg⟩H=E[⟨f,φ(x)⟩H⟨g,φ(x)⟩H]=E[f(x)g(x)].\langle f, \Sigma g \rangle_{\mathcal{H}} = \mathbb{E} \big[ \langle f, \varphi(x)\rangle_{\mathcal{H}}\langle g, \varphi(x)\rangle_{\mathcal{H}}\big] = \mathbb{E} \big[ f(x) g(x) \big].

The generalization property of ridge regression has been thoroughly studied (see, e.g., [8, 9]), and if there exists f∗∈Hf_\ast \in \mathcal{H} such that yi=⟨f∗,φ(xi)⟩+εiy_i = \langle f_\ast, \varphi(x_i) \rangle + \varepsilon_i for a noise εi\varepsilon_i which is independent of xix_i, with zero mean and variance equal to σ2\sigma^2, then the expected error on unseen data is asymptotically upper-bounded by

σ2+λ∥f∗∥H2+σ2ntr[Σ(Σ+λI)−1].\sigma^2 + \lambda \| f_\ast\|_{\mathcal{H}}^2 + \frac{\sigma^2}{n} {\rm tr} \big[ \Sigma ( \Sigma + \lambda I)^{-1} \big].
The first term σ2\sigma^2 is the best possible expected performance, the term λ∥f∗∥H2\lambda \| f_\ast\|_{\mathcal{H}}^2 is usually referred to as the bias term and characterizes the bias introduced by regularizing towards zero, while the third term σ2ntr[Σ(Σ+λI)−1]\frac{\sigma^2}{n} {\rm tr} \big[ \Sigma ( \Sigma + \lambda I)^{-1} \big] is the variance term, which characterizes the loss in performance due to the observation of only nn observations.

The quantity df(λ)=tr[Σ(Σ+λI)−1]{\rm df}(\lambda) = {\rm tr} \big[ \Sigma ( \Sigma + \lambda I)^{-1} \big] is often referred to as the degrees of freedom [10]. When λ\lambda tends to infinity, then df(λ){\rm df}(\lambda) tends to zero; when λ\lambda tends to zero, then df(λ){\rm df}(\lambda) tends to the number of non-zero eigenvalues of Σ\Sigma. Thus, in finite dimension, this typically leads to the underlying dimension. Given the usual variance term in σ2dn\sigma^2 \frac{d}{n} for ordinary least-squares with dd-dimensional features, df(λ){\rm df}(\lambda) is often seen as an implicit number of parameters for kernel ridge regression.

In infinite dimensions, under mild assumptions, there are infinitely many eigenvalues for Σ\Sigma, which form a decreasing sequence (λi)i⩾0(\lambda_i)_{i \geqslant 0} that tends to zero (and is summable, with a sum equal to the trace of Σ\Sigma). The rate of such a decay is key to understanding the generalization capabilities of kernel methods. With the following classical types of decays:

  • Polynomial decays: If λi⩽C(i+1)α\lambda_i \leqslant \frac{C}{(i+1)^{\alpha}} for α>1\alpha > 1, then one can upper bound the sum by an integral as
    tr[Σ(Σ+λI)−1]=∑i=0∞λiλi+λ⩽∑i=1∞11+λiα/C⩽∫0∞11+λtα/Cdt.{\rm tr} \big[ \Sigma ( \Sigma + \lambda I)^{-1} \big] = \sum_{i=0}^\infty \frac{\lambda_i}{\lambda_i + \lambda} \leqslant \sum_{i=1}^\infty \frac{1}{1 + \lambda i^\alpha / C} \leqslant \int_0^\infty \frac{1}{1+\lambda t^\alpha / C} dt.
    With the change of variable u=λtα/Cu = \lambda t^\alpha / C, we get that df(λ)=O(λ−α){\rm df}(\lambda) = O(\lambda^{-\alpha}). We can then balance bias and variance with λ∼n−α/(α+1)\lambda \sim n^{-\alpha/(\alpha+1)} and an excess risk proportional to n−α/(α+1)n^{-\alpha/(\alpha+1)}. This type of decay is typical of Sobolev spaces.
  • Exponential decays: If λi⩽Ce−αi\lambda_i \leqslant {C}e^{-\alpha i}, for some α>0\alpha >0, we have
    tr[Σ(Σ+λI)−1]⩽∑i=0∞Ce−αiλ+Ce−αi⩽∫0∞Ce−αtλ+Ce−αtdt.{\rm tr} \big[ \Sigma ( \Sigma + \lambda I)^{-1} \big] \leqslant \sum_{i=0}^\infty \frac{{C}e^{-\alpha i}}{ \lambda + {C}e^{-\alpha i}} \leqslant \int_{0}^\infty \frac{{C}e^{-\alpha t}}{ \lambda + {C}e^{-\alpha t}}dt.
    With the change of variable u=e−αtu = e^{-\alpha t}, we get an upper bound
    ∫01Cα1λ+Cudu=1α[log⁡(λ+C) –log⁡(λ)]=1αlog⁡(1+Cλ).\int_{0}^1 \frac{C}{\alpha}\frac{1}{ \lambda + {C}u}du = \frac{1}{\alpha}\big[ \log(\lambda + C) \ – \log (\lambda) \big] = \frac{1}{\alpha} \log \big( 1+\frac{C}{\lambda} \big).
    We can then balance bias and variance with λ∼1/n\lambda \sim 1/n and an excess risk proportional to (log⁡n)/n(\log n) / n, which is very close to the usual parametric (finite-dimensional) rate in O(1/n)O(1/n). We will see an example of this phenomenon for the Gaussian kernel.

In order to analyze the generalization capabilities, we consider a measure dμd \mu on X\mathcal{X}, and the following (non-centered) covariance operator defined above as

E[φ(x)⊗φ(x)],\mathbb{E} \big[ \varphi(x) \otimes \varphi(x) \big],
which is now an self-adjoint operator from H\mathcal{H} to H\mathcal{H} with a finite trace. The traditional empirical estimator Σ^=1n∑i=1nφ(xi)⊗φ(xi)\hat\Sigma = \frac{1}{n} \sum_{i=1}^n \varphi(x_i) \otimes \varphi(x_i), whose eigenvalues are the same as the eigenvalues of 1/n1/n times the n×nn \times n kernel matrix of pairwise kernel evaluations (see simulation below).

Characterizing eigenfunctions. If (gk)(g_k) is the eigenbasis associated to the eigenfunctions of Σ\Sigma, then it has to be an orthogonal family that span the entire space H\mathcal{H} and such that Σgk=λkgk\Sigma g_k = \lambda_k g_k. Applying it to φ(y)=K(⋅,y)\varphi(y) = K(\cdot,y), we get

⟨K(⋅,y),Σgk⟩H=E[K(x,y)gk(x)]=λk⟨gk,φ(y)⟩H=λkgk(y),\langle K(\cdot,y), \Sigma g_k \rangle_{\mathcal{H}} = \mathbb{E} \big[ K(x,y) g_k(x) \big] = \lambda_k \langle g_k, \varphi(y)\rangle_\mathcal{H} = \lambda_k g_k(y),
which implies that the functions also have to be eigenfunctions of the self-adjoint so-called integral operator TT defined on L2(dμ)L_2(d\mu) as Tf(y)=∫XK(x,y)f(y)dμ(y)T f(y) = \int_{\mathcal{X}} K(x,y) f(y) d\mu(y). Below, we will check this property. Note that this other notion of integral operator (defined on L2(dμ)L_2(d\mu) and not in H\mathcal{H}), which has the same eigenvalues and eigenfunctions, is important to deal with mis-specified models (see [9]). Note that the eigenfunctions gkg_k are orthogonal for both dot-products in L2(dμ)L_2(d\mu) and H\mathcal{H}, but that the normalization to unit norm differs. If ∥gk∥L2(dμ)=1\| g_k \|_{L_2(d\mu)}=1 for all k⩾0k \geqslant 0, then we have ∥gk∥H2=λk−1⟨gk,Σgk⟩H=λk−1E[gk(x)2]=λk−1\| g_k \|^2_\mathcal{H}= \lambda_k^{-1} \langle g_k, \Sigma g_k \rangle_\mathcal{H} = \lambda_k^{-1}\mathbb{E} [ g_k(x)^2] =\lambda_k^{-1} , and thus, ∥λk1/2gk∥H=1\| \lambda_k^{1/2} g_k \|_{\mathcal{H}}=1, and we have the kernel expansion from an orthonormal basis of H\mathcal{H}:
K(x,y)=∑k=0∞λkgk(x)gk(y),K(x,y) = \sum_{k=0}^\infty\lambda_k g_k(x) g_k(y),
which will lead to a new proof for Mehler formula.

Orthonormal basis for the Gaussian kernel

Hermite polynomials naturally lead to orthonormal basis of some reproducing kernel Hilbert spaces (RKHS). For simplicity, I will focus on one-dimensional problems, but this extends to higher dimension.

Translation-invariant kernels. We consider a function q:R→Rq: \mathbb{R} \to \mathbb{R} which is integrable, with Fourier transform (note the different normalization than before) which is defined for all ω∈R\omega \in \mathbb{R} because of the integrability:

q^(ω)=∫Rq(x)e−iωxdx.\hat{q}(\omega) = \int_{\mathbb{R}} q(x) e^{-i \omega x} dx.
We consider the kernel
K(x,y)=q(x−y).K(x,y) = q(x-y).
It can be check that as soon as q^(ω)∈R+\hat{q}(\omega) \in \mathbb{R}_+ for all ω∈R\omega \in \mathbb{R}, then the kernel KK is positive-definite.

For a translation-invariant kernel, we can write using the inverse Fourier transform formula:

K(x,y)=q(x−y)=12π∫Rq^(ω)eiω(x−y)dω=∫Rφω(x)∗φω(y)dω,K(x,y) = q(x-y) = \frac{1}{2\pi} \int_{\mathbb{R}} \hat{q}(\omega) e^{i \omega ( x- y)} d \omega = \int_{\mathbb{R}} \varphi_\omega(x)^* \varphi_\omega(y) d \omega,
with φω(x)=q^(ω)/(2π)eiωx\varphi_\omega(x) = \sqrt{\hat{q}(\omega) / (2\pi) } e^{i\omega x}. Intuitively, for a function f:R→Rf: \mathbb{R} \to \mathbb{R}, with f(x)=12π∫Rf^(ω)eiωxdω=∫Rf^(ω)2πq^(ω)φω(x)dω\displaystyle f(x) = \frac{1}{2\pi} \int_{\mathbb{R}} \hat{f}(\omega)e^{i\omega x} d\omega = \int_{\mathbb{R}} \frac{\hat{f}(\omega) }{\sqrt{2 \pi \hat{q}(\omega)}}\varphi_\omega(x) d\omega, which is a “dot-product” between the family (φω(x))ω(\varphi_\omega(x))_\omega and (f^(ω)2πq^(ω))ω\Big( \frac{\hat{f}(\omega) }{\sqrt{2 \pi \hat{q}(\omega)}} \Big)_\omega, the squared norm ∥f∥H2\| f\|_{\mathcal{H}}^2 is equal to the corresponding “squared norm” of (f^(ω)2πq^(ω))ω\Big( \frac{\hat{f}(\omega) }{\sqrt{2 \pi \hat{q}(\omega)}}\Big)_\omega, and we thus have
∥f∥H2=∫R∣f^(ω)2πq^(ω)∣2dω=12π∫R∣f^(ω)∣2q^(ω)dω,\| f\|_{\mathcal{H}}^2 = \int_{\mathbb{R}} \Big| \frac{\hat{f}(\omega) }{\sqrt{2 \pi \hat{q}(\omega)}} \Big|^2 d\omega = \frac{1}{2\pi} \int_{\mathbb{R}} \frac{ | \hat{f}(\omega) |^2}{\hat{q}(\omega)} d\omega,
where f^\hat{f} is the Fourier transform of ff. While the derivation above is not rigorous, the last expression is.

In this section, I will focus on the Gaussian kernel defined as K(x,y)=q(x−y)=exp⁡(–α(x−y)2)K(x,y) = q(x-y) = \exp \big( – \alpha ( x- y )^2 \big), for which q^(ω)=παexp⁡(–ω24α)\displaystyle \hat{q}(\omega)= \sqrt{\frac{\pi}{\alpha}} \exp\big( – \frac{\omega^2}{4 \alpha} \big).

Given that 1q^(ω)=απexp⁡(ω24α)=απ∑k=0∞ω2k(4α)kk!\displaystyle \frac{1}{\hat{q}(\omega)} = \sqrt{\frac{\alpha}{\pi}} \exp\big( \frac{\omega^2}{4 \alpha} \big)= \sqrt{\frac{\alpha}{\pi}} \sum_{k=0}^\infty \frac{\omega^{2k}}{(4 \alpha)^k k!}, the penalty ∥f∥H2\|f\|_\mathcal{H}^2 is a linear combination of squared L2L_2-norm of ωkf^(ω)\omega^k \hat{f}(\omega), which is the squared L2L_2-norm of the kk-th derivative of ff. Thus, functions in the RKHS are infinitely differentiable, and thus very smooth (this implies that to have the fast rate (log⁡n)/n(\log n) / n above, the optimal regression function has to be very smooth).

Orthonormal basis of the RKHS. As seen in Eq. (4), an expansion in an infinite sum is necessary to obtain an orthonormal basis. We have:

K(x,y)=e−αx2e−αy2e2αxy=e−αx2e−αy2∑k=0∞(2α)kk!xkyk.K(x,y) = e^{-\alpha x^2} e^{-\alpha y^2} e^{2 \alpha x y} = e^{-\alpha x^2} e^{-\alpha y^2} \sum_{k=0}^\infty \frac{ (2\alpha)^k}{k!} x^k y^k.
Because of Eq. (4), with gk(x)=(2α)kk!xkexp⁡(–αx2)g_k(x) = \sqrt{ \frac{(2\alpha)^k}{k!}} x^k \exp \big( – \alpha x^2 \big), we have a good candidate for an orthonornal basis. Let us check that this is the case. Note that the expansion above alone cannot be used as a proof that (gk)(g_k) is an orthonormal basis of H\mathcal{H}.

Given the function fk(x)=xkexp⁡(–αx2)f_k(x) = x^k \exp \big( – \alpha x^2 \big), we can compute its Fourier transform as

f^k(ω)=i−k(4α)−k/2παHk(ω4α)exp⁡(–ω24α).\hat{f}_k(\omega) = i^{-k} ( 4 \alpha)^{-k/2} \sqrt{\frac{\pi}{\alpha}} H_k \Big( \frac{\omega}{\sqrt{4 \alpha}} \Big) \exp\big( – \frac{\omega^2}{4 \alpha} \big) .
Indeed, we have, from Rodrigues’ formula,
Hk(ω4α)exp⁡(–ω24α)=(−1)k(4α)k/2dkdωk[exp⁡(–ω24α)],H_k \Big( \frac{\omega}{\sqrt{4 \alpha}} \Big) \exp\big( – \frac{\omega^2}{4 \alpha} \big) =(-1)^k (4 \alpha)^{k/2} \frac{d^k}{d \omega^k}\big[ \exp\big( – \frac{\omega^2}{4 \alpha} \big) \big],
and thus its inverse Fourier transform is equal to (ix)k(ix)^k times the one of (−1)k(4α)k/2exp⁡(–ω24α)(-1)^k (4 \alpha)^{k/2} \exp\big( – \frac{\omega^2}{4 \alpha} \big), which is thus equal to (−i)k(4α)k/2α/πe−αx2(-i)^k (4 \alpha)^{k/2} \sqrt{ \alpha / \pi }e^{-\alpha x^2}, which leads to the Fourier transform formula above.

We can now compute the RKHS dot products, to show how to obtain the orthonormal basis described in [11]. This leads to

⟨fk,fℓ⟩=12ππα(4α)−k/2(4α)−ℓ/2∫RHk(ω4α)Hℓ(ω4α)exp⁡(–ω24α)dω,\langle f_k, f_\ell \rangle = \frac{1}{2\pi} \sqrt{\frac{\pi}{\alpha}} ( 4 \alpha)^{-k/2}( 4 \alpha)^{-\ell/2} \int_{\mathbb{R}} H_k \Big( \frac{\omega}{\sqrt{4 \alpha}} \Big) H_\ell \Big( \frac{\omega}{\sqrt{4 \alpha}} \Big) \exp\big( – \frac{\omega^2}{4 \alpha} \big) d\omega,
which leads to, with a change of variable
⟨fk,fℓ⟩=12ππα(4α)−k/2(4α)−ℓ/24α∫RHk(u)Hℓ(u)exp⁡(−u2)du,\langle f_k, f_\ell \rangle = \frac{1}{2\pi} \sqrt{\frac{\pi}{\alpha}} ( 4 \alpha)^{-k/2}( 4 \alpha)^{-\ell/2} \sqrt{4 \alpha} \int_{\mathbb{R}} H_k (u) H_\ell (u) \exp(-u^2) du,
which is equal to zero if k≠ℓk \neq \ell, and equal to 12ππα(4α)−k4απ2kk!=(2α)−kk!\frac{1}{2\pi} \sqrt{\frac{\pi}{\alpha}} ( 4 \alpha)^{-k} \sqrt{4 \alpha} \sqrt{\pi} 2^k k! = ( 2 \alpha)^{-k} k! if k=ℓk = \ell. Thus the sequence (fk)(f_k) is an orthogonal basis of the RKHS, and the sequence (gk)(g_k) defined as gk(x)=(2α)kk!fk(x)g_k(x) = \sqrt{ \frac{(2\alpha)^k}{k!}} f_k(x) is an orthonormal basis of the RKHS, from which, using the expansion as in Eq. (4), we recover the expansion:
K(x,y)=∑k=0∞gk(x)gk(y)=e−αx2e−αy2∑k=0∞(2α)kk!xkyk.K(x,y) = \sum_{k=0}^\infty g_k(x) g_k(y) = e^{-\alpha x^2} e^{-\alpha y^2} \sum_{k=0}^\infty \frac{ (2\alpha)^k}{k!} x^k y^k.

This expansion can be used to approximate the Gaussian kernel by finite-dimensional explicit feature spaces, by just keeping the first basis elements (see an application to optimal transport in [12], with an improved behavior using an adaptive low-rank approximation through the Nyström method in [13]).

Eigenfunctions for the Gaussian kernels

In order to obtain explicit formulas for the eigenvalues of the covariance operator, we need more than a mere orthonormal basis, namely an eigenbasis.

An orthogonal basis will now be constructed with arguably better properties as it is also an orthonormal basis for both the RKHS and L2(dμ)L_2(d\mu) for a Gaussian measure, that diagonalizes the integral operator associated to this probability measure, as well as the covariance operator.

As seen above, we simply need an orthogonal family (fk)k⩾0(f_k)_{k \geqslant 0}, such that given a distribution dμd\mu, (fk)k⩾0(f_k)_{k \geqslant 0} is a family in L2(dμ)L_2(d\mu) such that

∫Rfk(x)K(x,y)dμ(x)=λkfk(y),(5)\int_{\mathbb{R}} f_k(x) K(x,y) d\mu(x) = \lambda_k f_k(y), \tag{5}
for eigenvalues (λk)(\lambda_k). In the next paragraph, we will do exactly this for the Gaussian kernel K(x,y)=e−α(x−y)2K(x,y) = e^{-\alpha (x-y)^2} for α=ρ1−ρ2\alpha = \frac{\rho}{1- \rho^2} for some ρ∈(0,1)\rho \in (0,1); this particular parameterization in ρ\rho is to make the formulas below not (too) complicated.

With fk(x)=1NkHk(x)exp⁡(–ρ1+ρx2)f_k(x) = \frac{1}{\sqrt{N_k}} H_k(x) \exp \Big( – \frac{\rho}{1+\rho} x^2 \Big), where Nk=2kk!1−ρ1+ρN_k = {2^k k!} \sqrt{ \frac{1-\rho}{1+\rho}}, then (fk)k⩾0(f_k)_{k \geqslant 0} is an orthonormal basis for L2(dμ)L_2(d\mu) for dμd\mu the Gaussian distribution with mean zero and variance 121+ρ1−ρ\frac{1}{2} \frac{1+\rho}{1-\rho} (this is a direct consequence of the orthogonality property of Hermite polynomials).

Moreover, the moment of the Hermite polynomial in Eq. (3) exactly leads to Eq. (5) for the chosen kernel and λk=(1−ρ)ρk\lambda_k = (1-\rho) \rho^k. Since the eigenvalues sum to one, and the trace of Σ\Sigma is equal to one (as a consequence of K(x,x)=1K(x,x)=1), the family (fk)(f_k) has to be a basis of H\mathcal{H}.

From properties of the eigenbasis, since (fk)(f_k) is an orthonormal eigenbasis of L2(dμ)L_2(d\mu) and the eigenvalues are λk=(1−ρ)ρk\lambda_k = (1-\rho)\rho^k, we get:

K(x,y)=exp⁡(–ρ1−ρ2(x−y)2)=∑k=0∞(1−ρ)ρkfk(x)fk(y),K(x,y) = \exp \Big( – \frac{\rho}{1- \rho^2} (x-y)^2\Big) = \sum_{k=0}^\infty (1-\rho)\rho^k f_k(x) f_k(y),
which is exactly the Mehler formula, and thus we obtain an alternative proof.

We then get an explicit basis and the exponential decay of eigenvalues, which was first outlined by [2]. See an application to the estimation of the Poincaré constant in [14] (probably a topic for another post in a few months).

Experiments. In order to showcase the exact eigenvalues of the expectation Σ\Sigma (for the correct combination of Gaussian kernel and Gaussian distribution), we compare the eigenvalues with the ones of the empirical covariance operator Σ^\hat\Sigma, for various values of the number of observations. We see that as nn increases, the empirical eigenvalues match the exact ones for higher kk.

Eigenvalues of the covariance operator Σ\Sigma (“expectation”) compared to the ones of the empirical covariance operator Σ^\hat\Sigma, averaged over 20 replications (“empirical”), for several values of nn.

Conclusion

In this post, I only presented applications of Hermite polynomials to the Gaussian kernel, but these polynomials appear in many other areas of applied mathematics, for other types of kernels within machine learning such as dot-product kernels [3], in random matrix theory (see here), in statistics for Edgeworth expansions, and of course for Gauss-Hermite quadrature.

Acknowledgements. I would like to thank Loucas Pillaud-Vivien and Alessandro Rudi for proofreading this blog post and making good clarifying suggestions.

References

[1] George Neville Watson. Notes on Generating Functions of Polynomials: (2) Hermite Polynomials. Journal of the London Mathematical Society, 8, 194-199, 1933. [2] Huaiyu Zhu, Christopher K. I. Williams, Richard Rohwer, and Michal Morciniec. Gaussian regression and optimal finite dimensional linear models. In Neural Networks and Machine Learning. Springer-Verlag, 1998. [3] A. Daniely, R. Frostig, and Y. Singer. Toward deeper understanding of neural networks: The power of initialization and a dual view on expressivity. In Advances In Neural Information Processing Systems, 2016. [4] Gabor Szegö. Orthogonal polynomials. American Mathematical Society, 1939. [5] Grace Wahba. Spline models for observational data. Society for Industrial and Applied Mathematics, 1990. [6] Bernhard Schölkopf, Alexander J. Smola. Learning with kernels: support vector machines, regularization, optimization, and beyond. MIT Press, 2002. [7] John Shawe-Taylor, Nello Cristianini. Kernel methods for pattern analysis. Cambridge University Press, 2004. [8] Andrea Caponnetto, Ernesto De Vito. Optimal rates for the regularized least-squares algorithm. Foundations of Computational Mathematics 7.3: 331-368, 2007. [9] Jerome Friedman, Trevor Hastie, and Robert Tibshirani. The elements of statistical learning. Vol. 1. No. 10. Springer series in statistics, 2001. [10] Trevor Hastie and Robert Tibshirani. Generalized Additive Models. Chapman & Hall, 1990. [11] Ingo Steinwart, Don Hush, and Clint Scovel. [An explicit description of the reproducing kernel Hilbert spaces of Gaussian RBF kernels](http://[PDF] ieee.org). IEEE Transactions on Information Theory, 52.10:4635-4643, 2006. [12] Jason Altschuler, Francis Bach, Alessandro Rudi, Jonathan Niles-Weed. Approximating the quadratic transportation metric in near-linear time. Technical report arXiv:1810.10046, 2018. [13] Jason Altschuler, Francis Bach, Alessandro Rudi, Jonathan Niles-Weed. Massively scalable Sinkhorn distances via the Nyström method. Advances in Neural Information Processing Systems (NeurIPS), 2019. [14] Loucas Pillaud-Vivien, Francis Bach, Tony Lelièvre, Alessandro Rudi, Gabriel Stoltz. Statistical Estimation of the Poincaré constant and Application to Sampling Multimodal Distributions. Proceedings of the International Conference on Artificial Intelligence and Statistics (AISTATS), 2020. [15] Nachman Aronszajn. Theory of Reproducing Kernels. Transactions of the American Mathematical Society, 68(3): 337–404, 1950.

Proof of properties of Hermite polynomials

In this small appendix, I give “simple” proofs (that sometimes require knowledge of complex analysis) to the properties presented above.

Generating function. We have, using residue theory,

Hk(x)=(−1)kex2dkdxk[e−x2]=(−1)kk!2iπex2∮γe−z2(z−x)k+1dz,H_k(x)=(-1)^k e^{x^2} \frac{d^k}{d x^k}\big[ e^{-x^2} \big] = (-1)^k \frac{k!}{2i\pi} e^{x^2} \oint_\gamma \frac{e^{-z^2}}{(z-x)^{k+1}}dz,
where γ\gamma is a contour in the complex plane around xx. This leads to, for any tt (here, we ignore on purpose the summability issues, for more details, see [4, Section 5.5]):
∑k=0∞tkk!Hk(x)=12iπex2∮γe−z2z−x∑k=0∞tk(x−z)kdz,\sum_{k=0}^\infty \frac{t^k}{k!} H_k(x) = \frac{1}{2i\pi} e^{x^2} \oint_\gamma \frac{e^{-z^2}}{z-x} \sum_{k=0}^\infty \frac{t^k} {(x-z)^{k}}dz,
which can be simplified using the sum of the geometric series, leading to
12iπex2∮γe−z2z−xz−xz−x−tdz=12iπex2∮γe−z2z−x−tdz.\frac{1}{2i\pi} e^{x^2} \oint_\gamma \frac{e^{-z^2}}{z-x} \frac{z-x}{z-x- t} dz = \frac{1}{2i\pi} e^{x^2} \oint_\gamma \frac{e^{-z^2}} {z-x- t} dz.
Using the first-order residue at x+tx+t. This is thus equal to ex2−(t+x)2=e−t2+2txe^{x^2-(t+x)^2} = e^{-t^2 + 2tx}, which is exactly the generating function statement from Eq. (2).

Orthogonality for Gaussian distribution. We can prove through integration by parts, but there is a nicer proof through the generating function. Indeed, with

akℓ=∫−∞+∞e−x2Hk(x)Hℓ(x)dx,a_{k \ell} = \int_{-\infty}^{+\infty} e^{-x^2} H_k(x) H_\ell(x) dx,
for k,ℓ⩾0k, \ell \geqslant 0, we get
∑k,ℓ=0∞akℓtkuℓk!ℓ!=∫−∞+∞e−x2(∑k,ℓ=0∞akℓtkuℓk!ℓ!Hk(x)Hℓ(x))dx.\sum_{k,\ell = 0}^\infty a_{k \ell} \frac{t^k u^\ell}{k! \ell!} = \int_{-\infty}^{+\infty}e^{-x^2}\Big( \sum_{k,\ell = 0}^\infty a_{k \ell} \frac{t^k u^\ell}{k! \ell!} H_k(x) H_\ell(x) \Big) dx.
Using the generating function, this leads to
∑k,ℓ=0∞akℓtkuℓk!ℓ!=∫−∞+∞e−x2+2xu−u2+2xt–t2dx=e2uv∫−∞+∞e−(x−u−v)2dx,\sum_{k,\ell = 0}^\infty a_{k \ell} \frac{t^k u^\ell}{k! \ell!} = \int_{-\infty}^{+\infty} e^{-x^2 + 2xu-u^2 + 2xt – t^2} dx= e^{2uv} \int_{-\infty}^{+\infty} e^{-(x-u-v)^2}dx,
which can be computed explicitly using normalization constants of the Gaussian distribution, as πe2uv=π∑k=0∞(2uv)kk!,\sqrt{\pi} e^{2uv} = \sqrt{\pi} \sum_{k=0}^\infty \frac{ (2 u v)^k}{k!}, leading to all desired orthogonality relationships using the uniqueness of all coefficients for factors tkuℓt^k u^\ell.

Recurrence relationship. Taking the derivative of the generating function with respect to tt, one gets (2x−2t)e2tx−t2=∑k=0∞tk−1(k−1)!Hk(x),\displaystyle (2x-2t) e^{2tx-t^2} = \sum_{k=0}^\infty \frac{t^{k-1}}{(k-1)!} H_k(x), which is equal to (using again the generating function) ∑k=0∞tkk!2xHk(x) –∑n=0∞tk+1k!2Hk(x).\displaystyle \sum_{k=0}^\infty \frac{t^{k}}{k!} 2x H_k(x) \ – \sum_{n=0}^\infty \frac{t^{k+1}}{k!} 2 H_k(x). By equating the coefficients for all powers of tt, this leads to the desired recursion in Eq. (1).

Fourier transform. Again using the generating function, written

e−x2/2+2xt–t2=∑k=0∞tkk!e−x2/2Hk(x),e^{-x^2/2 + 2xt – t^2} = \sum_{k=0}^\infty \frac{t^k}{k!} e^{-x^2/2} H_k(x),
we can take Fourier transforms and use the fact that the Fourier transform of e−x2/2e^{-x^2/2} is itself (for the chosen normalization), and then equate coefficients for all powers of tt to conclude (see more details here).

Expectation for Gaussian distributions. We finish the appendix by proving Eq. (3). We consider computing for any tt,

∑k=0∞ρktkk!Hk(y)=e2ρty–ρ2t2,\sum_{k=0}^\infty \rho^k \frac{t^k}{k!} H_k (y) = e^{2\rho t y – \rho^2 t^2},
using the generating function from Eq. (2). We then compute
A=∫−∞∞exp⁡(–(x−ρy)21−ρ2)∑k=0∞tkk!Hk(x)dx=∫−∞∞exp⁡(–(x−ρy)21−ρ2)exp⁡(2tx–t2)dx.A=\int_{-\infty}^\infty \exp\Big( – \frac{(x-\rho y)^2}{1-\rho^2} \Big) \sum_{k=0}^\infty \frac{t^k}{k!} H_k(x) dx = \int_{-\infty}^\infty \exp\Big( – \frac{(x-\rho y)^2}{1-\rho^2} \Big) \exp( 2tx – t^2) dx.
We then use (x−ρy)21−ρ2–2tx+t2=x21−ρ2–2x[t(1−ρ2)+ρy]1−ρ2+t2+ρ2y21−ρ2\frac{(x-\rho y)^2}{1-\rho^2} – 2tx + t^2 = \frac{x^2}{1-\rho^2} – \frac{2x[ t(1-\rho^2) + \rho y]}{1-\rho^2} + t^2 + \frac{\rho^2 y^2}{1-\rho^2}, leading to
A=π1−ρ2exp⁡(−t2–ρ2y21−ρ2+(1−ρ2)(t+ρy1−ρ2)2)=π1−ρ2e2ρty–ρ2t2.A = \sqrt{\pi} \sqrt{1-\rho^2} \exp\Big( -t^2 – \frac{\rho^2 y^2}{1-\rho^2} +(1-\rho^2) \big( t + \frac{\rho y}{1-\rho^2} \big)^2 \Big) = \sqrt{\pi} \sqrt{1-\rho^2} e^{2\rho t y – \rho^2 t^2}.
By equating powers of tt, this leads to Eq. (3).