Post · 30 min read· pp. 342–354

Unraveling spectral properties of kernel matrices – I

Since my early PhD years, I have plotted and studied eigenvalues of kernel matrices. In the simplest setting, take independent and identically distributed (i.i.d.) data, such as in the cube below in 2 dimensions, take your favorite kernels, such as the Gaussian or Abel kernels, plot eigenvalues in decreasing order, and see what happens. The goal of this sequence of blog posts is to explain what we observe.

Gaussian kernel. Left: 1000 observations in the unit cube [0, ⁣1]2[0,\!1]^2. Right: ordered eigenvalues in log-scale for the Gaussian kernel k(x,y)=exp⁡( −∥x –y∥22/2 )k(x,y) = \exp( \,- \| x \, – y\|_2^2 / 2\, ), where ∥⋅∥2\|\cdot\|_2 denotes the ℓ2\ell_2-norm. Ten replications are plotted as a video.

Abel kernel. Left: 1000 observations in the unit cube [0, ⁣1]2[0,\!1]^2. Right: ordered eigenvalues in log-scale for the Abel kernel k(x,y)=exp⁡( −∥x –y∥2)k(x,y) = \exp( \,- \| x\, – y\|_2 ). Ten replications are plotted as a video.

In the plots above we see a certain number of things:

  • Over replications, we see a certain stability, that is, eigenvalues do not change much. We will see that this is due to a well-defined limit when the number nn of observations tend to infinity, and will precisely study the limit behavior.
  • Largest eigenvalues seem to appear with levels, (not surprisingly) reminiscent of energy levels in physics. This can also be explained, by the tensorial nature of the problem and symmetries.
  • The two kernels have a different set of eigenvalues, with fast decay for the Gaussian kernel (machine precision is already attained at the 100100-th eigenvalue), and slower for the Abel kernel. The spectral behavior can also be well explained based on Fourier analysis.

Why is this important?

Eigenvalue decays of kernel matrices come up in most statistical and algorithmic analyses associated with kernel methods, or where kernel methods are used to explain the statistical behavior of other learning frameworks such as neural networks (see, e.g., [1, Chapter 9]). Here are a few instances.

Control of approximation properties of kernel matrices by column sampling. A kernel matrix K∈Rn×nK \in \mathbb{R}^{n \times n} is a large object whose algorithmic manipulation can lead to running-time complexities that are at least O(n2)O(n^2) just to compute the matrix, and often more, e.g., O(n3)O(n^3) to implement learning algorithms. This is a common reason to discard kernel methods when nn is large. However, there exist several methods to even avoid computing the full kernel matrix, and obtain running-time complexities that are sub-quadratic in nn, and sometimes slightly super-linear in nn.

A classical technique from numerical linear algebra is to approximate a positive semidefinite matrix KK from a subset of its columns, which come under many different names, e.g., Nyström method [2], incomplete Cholesky decomposition [3, 4] or CUR matrix decompositions [5]. Another classical technique is to use random features [6]. There is now a significant body of literature characterizing the required rank of these approximations [5, 7, 8, 9, 10]. All of them highlight that the spectral decay of the kernel matrices, that is, how fast eigenvalues go to zero, is key.

Convergence rates of optimization algorithms. Many supervised learning formulations based on optimization and kernel methods often end up having the kernel matrix as the Hessian of the problem. Thus, its condition number (ratio of largest to smallest eigenvalue) characterizes the convergence of gradient-based techniques, hence the need for a precise spectral analysis. Note that the convergence of (stochastic) optimization algorithms depend on much more than the condition number and, in the infinite-dimensional kernel context, how fast eigenvalues decay to zero is crucial, both for theoretical analysis (see, e.g., [11]) and for the design of potential acceleration schemes (see, e.g., [12, 13]).

Generalization guarantees for kernel methods. The spectral decay characterizes the amount of correlation between features. Not surprisingly, it is crucial in the fine analysis of kernel methods, as detailed below once covariance operators are introduced.

Asymptotic analyses

In this sequence of blog posts, we thus consider observations x1,…,xnx_1,\dots,x_n in a set X\mathcal{X} (which can be quite arbitrary) sampled independently and identically distributed (i.i.d.) from a probability distribution μ\mu, and a positive definite kernel k:X×X→Rk: \mathcal{X} \times \mathcal{X} \to \mathbb{R}. We then form the kernel matrix K∈Rn×nK \in \mathbb{R}^{n \times n}, defined as:

Kij=k(xi,xj).K_{ij} = k(x_i,x_j).
It is a random positive semi-definite matrix, thus with nn real eigenvalues.

Several analyses have been carried out to understand the spectrum of KK. When X=Rd\mathcal{X}=\mathbb{R}^d and the distribution of inputs has sufificient symmetries or independence properties, random matrix theory can be used to study the spectrum as both dd (the dimension of the input space X\mathcal{X}) and nn (number of observations) grow [14]. In another more recent line of work, asymptotic analyses around the “flat” limit (constant kernel matrices) can be carried out without the need to let nn tend to infinity (see [15] and references therein). In this blog post, I will describe an analysis that is classical in statistics, optimization and machine learning, that is, the limit when nn tends to infinity (with the input space X\mathcal{X} being fixed). We will show below that the eigenvalues will be related to the eigenvalues of the potentially infinite-dimensional covariance operator which we now define.

Covariance operator

We define Σ\Sigma the (non-centered) covariance operator associated with the probability measure μ\mu and the kernel kk as follows. Like all positive definite kernels, we can write it as (a key result due to Aronszajn in 1950):

k(x,y)=⟨φ(x),φ(y)⟩k(x,y) = \langle \varphi(x) , \varphi(y) \rangle
for any feature map φ:X→H\varphi: \mathcal{X} \to \mathcal{H} that represents the positive definite kernel, with H\mathcal{H} a Hilbert space, with norm ∥⋅∥\| \cdot \| and dot product ⟨⋅,⋅⟩\langle \cdot, \cdot \rangle.

We assume that ∫Xk(x,x)dμ(x)\int_\mathcal{X} k(x,x) d\mu(x) is finite, which is a weak assumption as for many kernel functions, k(x,x)k(x,x) is uniformly bounded. The covariance operator is then defined from H\mathcal{H} to H\mathcal{H} through

⟨f,Σg⟩=∫X⟨f,φ(x)⟩⟨g,φ(x)⟩dμ(x),\langle f, \Sigma g \rangle = \int_{\mathcal{X}} \langle f,\varphi(x) \rangle \langle g,\varphi(x) \rangle d\mu(x),
which corresponds to the notation Σ=∫Xφ(x)⊗φ(x)dμ(x).\displaystyle\Sigma = \int_{\mathcal{X}} \varphi(x) \otimes \varphi(x) d\mu(x). In finite dimension, we can identify it to the matrix ∫Xφ(x)φ(x)⊤dμ(x)\displaystyle \int_{\mathcal{X}} \varphi(x) \varphi(x)^\top d\mu(x). Throughout this blog post, we assume that H\mathcal{H} is infinite-dimensional.

In technical terms, the operator Σ\Sigma is compact. Thus, there exists a non-increasing sequence of strictly positive eigenvalues (λm)m⩾0(\lambda_m)_{m \geqslant 0} tending to zero, and of eigenvectors (elements of H\mathcal{H} that form an orthonormal basis) (fm)m⩾0(f_m)_{m \geqslant 0} such that Σfm=λmfm\Sigma f_m = \lambda_m f_m, that is,

Σfm=∫Xφ(x)⟨φ(x),fm⟩dμ(x)=λmfm,(1)\Sigma f_m = \int_{\mathcal{X}} \varphi(x) \langle \varphi(x), f_m \rangle d\mu(x) = \lambda_m f_m, \tag{1}
which we can write for any y∈Xy \in \mathcal{X},
⟨φ(y),Σfm⟩=∫Xk(x,y)⟨φ(x),fm⟩dμ(x)=λm⟨φ(y),fm⟩.\langle \varphi(y), \Sigma f_m \rangle = \int_{\mathcal{X}} k(x,y) \langle \varphi(x), f_m \rangle d\mu(x) = \lambda_m \langle \varphi(y), f_m\rangle .

Thus, the functions gm:x↦⟨λm−1/2φ(x),fm⟩g_m: x \mapsto \langle \lambda_m^{-1/2} \varphi(x), f_m \rangle are eigenfunctions (e.g., eigenvectors) of the integral operator from L2(μ)L_2(\mu) to L2(μ)L_2(\mu) defined as

Tg(x)=∫Xk(x,y)g(y)dμ(y).T g(x) = \int_{\mathcal{X}} k(x,y) g(y)d\mu(y).
The factor λm−1/2\lambda_m^{-1/2} is here to ensure that ∫Xgm(x)2dμ(x)=1\int_{\mathcal{X}} g_m(x)^2 d\mu(x) = 1, as a consequence of Eq. (1)(1), that is, the functions gmg_m have unit norm in L2(μ)L_2(\mu).

We can then decompose in the orthonormal basis of H\mathcal{H} the vector φ(y)=∑m⩾0⟨φ(y),fm⟩fm\varphi(y) = \sum_{m \geqslant 0} \langle \varphi(y), f_m \rangle f_m, leading to by taking the dot-product with φ(x)\varphi(x):

k(x,y)=∑m⩾0λm⟨φ(y),λm−1/2fm⟩⟨φ(x),λm−1/2fm⟩=∑m⩾0λmgm(x)gm(y),k(x,y) = \sum_{m \geqslant 0} \lambda_m \langle \varphi(y), \lambda_m^{-1/2} f_m \rangle \langle \varphi(x), \lambda_m^{-1/2} f_m \rangle= \sum_{m \geqslant 0} \lambda_m g_m(x) g_m(y),
which is a Mercer decomposition.

Ridge regression. Following [16], we can consider regression problems where outputs yy are modeled as y=f(x)+εy=f(x) + \varepsilon, where ff is an arbitrary function and ε\varepsilon a random variable with zero mean and variance σ2\sigma^2. If kernel ridge regression (least-squares empirical loss for the prediction function f:x↦⟨φ(x),θ⟩f:x \mapsto \langle \varphi(x), \theta \rangle with Hilbertian regularizer λ∥θ∥2\lambda \| \theta \|^2) is used, then the expected prediction performance depends on the noise variance with a term of the form

σ2∑m⩾0λmλm+λ=σ2tr[Σ(Σ+λI)−1],\sigma^2 \sum_{m \geqslant 0} \frac{\lambda_m}{\lambda_m + \lambda}= \sigma^2{\rm tr} \big[ \Sigma (\Sigma + \lambda I)^{-1} \big],
where (λm)m⩾0(\lambda_m)_{m \geqslant 0} are the eigenvalues of the covariance operator defined above, and λ\lambda is the regularization parameter. The term tr[Σ(Σ+λI)−1]{\rm tr} [ \Sigma (\Sigma + \lambda I)^{-1} ] is usually referred to as the degrees of freedom, and thus key to understanding the sampling behavior of methods based on kernels.

Degrees of freedom and boundedness of eigenfunctions. Since the function μ↦μ/(μ+λ)\mu \mapsto \mu / (\mu+\lambda) is increasing on R+\mathbb{R}_+, from 00 to 11, with value 1/21/2 at μ=λ\mu=\lambda, the degrees of freedom can be seen as a “soft count” of the number of eigenvalues that are greater than λ\lambda. Since we have assumed that we have an infinite non-increasing sequence of eigenvalues that tend to zero, tr[Σ(Σ+λI)−1]{\rm tr} [ \Sigma (\Sigma + \lambda I)^{-1} ] tends to infinity when λ\lambda tends to zero, and the rate at which it tends to infinity is essentially equivalent to the rate at which λm\lambda_m tends to zero when mm tends to infinity. For example, when λm∼m−α\lambda_m \sim m^{-\alpha} (up to constants) for α>1\alpha > 1, then tr[Σ(Σ+λI)−1]∼λ−1/α{\rm tr} [ \Sigma (\Sigma + \lambda I)^{-1} ] \sim \lambda^{-1/\alpha} (up to constants), and for λm∼ρm\lambda_m \sim \rho^m, then we get a dependence in 1ρlog⁡1λ\frac{1}{\rho} \log \frac{1}{\lambda}(see, e.g., [7, Appendix C], for detailed computations).

In the analysis of kernel methods, another notion of degrees of freedom is often used (like done in probabilistic statements below), which is sometimes referred to as the maximal degrees of freedom, or maximal leverage scores, that we define as

df(λ)=sup⁡x∈X ⟨φ(x),(Σ+λI)−1φ(x)⟩.{\rm df}(\lambda) = \sup_{x \in \mathcal{X}}\ \langle \varphi(x), (\Sigma + \lambda I)^{-1} \varphi(x) \rangle.
We always have tr[Σ(Σ+λI)−1]⩽df(λ){\rm tr} [ \Sigma (\Sigma + \lambda I)^{-1} ] \leqslant {\rm df}(\lambda), and if the eigenfunctions gmg_m are uniformly bounded in L∞L_\infty-norm, we have
df(λ)⩽sup⁡x∈Xsup⁡m⩾0∣gm(x)∣2⋅tr[Σ(Σ+λI)−1],{\rm df}(\lambda) \leqslant \sup_{x \in \mathcal{X}} \sup_{m \geqslant 0} | g_m(x)|^2 \cdot {\rm tr} [ \Sigma (\Sigma + \lambda I)^{-1} ],
and thus df(λ){\rm df}(\lambda) and tr[Σ(Σ+λI)−1]{\rm tr} [ \Sigma (\Sigma + \lambda I)^{-1} ] have the same growth.

Removing randomness

We can now explain the behavior of eigenvalues of 1nK\frac{1}{n} K when μ\mu is a probability measure, by noticing that its nn eigenvalues are the first nn eigenvalues of the empirical covariance operator (also from H\mathcal{H} to H\mathcal{H})

Σ^=1n∑i=1nφ(xi)⊗φ(xi)\hat{\Sigma} = \frac{1}{n} \sum_{i=1}^n \varphi(x_i) \otimes \varphi(x_i)
(this is a consequence of the non-zero eigenvalues of 1nΦΦ∗\frac{1}{n} \Phi \Phi^\ast being exactly the ones of 1nΦ∗Φ\frac{1}{n} \Phi^\ast \Phi for any matrix or linear operator Φ\Phi).

We can then rely on the fact that Σ^\hat{\Sigma} tends to Σ\Sigma in a variety of potential norms and probabilistic statements. The simplest is convergence in Hilbert-Schmidt norm (which is the Frobenius norm in finite dimension), that is,

E[∥Σ –Σ^∥HS2]=1nE[∥Σ –φ(x)⊗φ(x)∥HS2]⩽1n∫Xk(x,x)2dμ(x).\mathbb{E} \big[ \| \Sigma \, – \hat{\Sigma} \|_{\rm HS}^2 \big] = \frac{1}{n} \mathbb{E} \big[ \| \Sigma \, – \varphi(x) \otimes \varphi(x) \|_{\rm HS}^2\big] \leqslant \frac{1}{n}\int_\mathcal{X} k(x,x)^2 d\mu(x).
Note here that the fact that our features φ\varphi are infinite-dimensional never appeared, as long as the integral above is finite, which is the case as soon as the kernel is bounded on X×X\mathcal{X} \times \mathcal{X}.

By the Hoffman-Wielandt inequality [17], we get

∑m⩾0∣λm(Σ) –λm(Σ^)∣2⩽∥Σ –Σ^∥HS2,\sum_{m \geqslant 0} | \lambda_m(\Sigma) \, – \lambda_m(\hat{\Sigma}) |^2 \leqslant \| \Sigma \, – \hat{\Sigma} \|_{\rm HS}^2,
and thus all eigenvalues converge at least at rate O(1/n)O(1/\sqrt{n}). This can be extended to other norms, in particular through the use of the operator norm (largest eigenvalue in absolute value), with then a need for a careful treatment of infinite dimensions (see [18, 19] and the end of the post for an example).

However, given that eigenvalues λm\lambda_m converge to zero when mm tends to infinity, and sometimes quite fast (as we explain below), a uniform approximation rate independent of mm does not correspond to what we see in the figure above, where, in log-scale, we obtain variations that have a similar range for all mm. There exists more refined statements that are sharper, starting from [20], which shows that in the most regular situations (e.g., uniformly bounded eigenfunctions gmg_m), we obtain the bound up to logarithmic terms

∣λm(Σ) –λm(Σ^)∣=O(λm(Σ)rn+∑i>rλi(Σ)),| \lambda_m(\Sigma) \, – \lambda_m(\hat\Sigma) | = O \Big( \lambda_m(\Sigma) \frac{r} {\sqrt{n}} + \sum_{i > r} \lambda_i(\Sigma) \Big),
which can be optimized with respect to r∈{1,,˙n}r \in \{1,\dot,n\}. It corresponds with the notations of this blog to
∣λm(Σ) –λm(Σ^)∣=O(df(λ)nλm(Σ)+λdf(λ)),| \lambda_m(\Sigma)\, – \lambda_m(\hat\Sigma) | = O \Big( \frac{{\rm df}(\lambda) } {\sqrt{n}} \lambda_m(\Sigma)+ \lambda {\rm df}(\lambda) \Big),
with a parameter λ>0\lambda >0, that can be optimized. At the end of the post, by simply using a similar inequality as the Hoffman-Wielandt inequality, but this time on the matrix logarithm, we obtain a novel improved bound (still up to logarithmic terms)
∣λm(Σ) –λm(Σ^)∣=O((λm(Σ)+λ)⋅df(λ)n).| \lambda_m(\Sigma) \, – \lambda_m(\hat\Sigma) | =O\Big( (\lambda_m(\Sigma) +\lambda) \cdot \sqrt{ \frac{{\rm df}(\lambda)}{n}}\Big).
See more details and comparisons at the end of this blog, and a detailed asymptotic analysis in [21].

(added January 9, 2024 : My colleague Alessandro Rudi pointed out that he already obtained the same result with a more direct argument with Dmitrii Ostrovskii. See the end of the post)

Studying eigenvalues of covariance operators. From now on, we only consider covariance operators and our goal is to understand their spectral properties. In these blog posts, we will consider two domains X\mathcal{X} of interest: the dd-dimensional torus (that is, [0, ⁣1]d[0,\! 1]^d with periodicity conditions) and Rd\mathbb{R}^d, both with translation-invariant kernels. The first one in this blog post because everything will be easy to deal with (with exact expressions for eigenvalues), the second in the next post because it is ubiquitous in practice but requires finer tools to characterize asymptotic behaviors.

Periodic translation-invariant kernels on [0, ⁣1][0,\! 1]

We consider kernel functions on X=[0, ⁣1]\mathcal{X} = [0,\! 1] that depend only on the fractional part of x−yx-y, that is,

k(x,y)=q(x−y),k(x,y) = q(x-y),
for a 11-periodic function qq. What makes everything easy in this situation, is that the (complex-valued) functions x↦e2iπωxx \mapsto e^{2i\pi\omega x}, for ω∈Z\omega \in \mathbb{Z}, form an orthonormal basis of L2([0,1])L_2([0,1]), so that we have the decomposition
k(x,y)=∑ω∈Zq^ωe2iπω(x−y)=∑ω∈Zq^ωe2iπωx(e2iπωy)∗.k(x,y) = \sum_{\omega \in \mathbb{Z}} \hat{q}_\omega e^{2i\pi\omega (x-y)}= \sum_{\omega \in \mathbb{Z}} \hat{q}_\omega e^{2i\pi \omega x} (e^{2i\pi \omega y})^\ast.
Thus, the square-integrable eigenfunctions are gω(x)=e2iπωxg_\omega(x) = e^{2i\pi \omega x} for ω∈Z\omega \in \mathbb{Z} (they are thus exactly equal to 11 in magnitude), and eigenvalues of the covariance operators are exactly the Fourier coefficients q^ω∈R+\hat{q}_\omega \in \mathbb{R}_+. In order to have a real-valued symmetric kernel function, for all ω∈Z\omega \in \mathbb{Z}, q^−ω=q^ω\hat{q}_{-\omega} = \hat{q}_\omega, and thus, if the Fourier series is decreasing in ∣ω∣|\omega|, the sequence of eigenvalues is
q^0,q^1,q^1,q^2,q^2,…,\hat{q}_{0}, \hat{q}_{1},\hat{q}_{1}, \hat{q}_{2},\hat{q}_{2}, \dots,
with thus eigenvalues coming at least by pairs (except the first one).

It is not the topic of today, but the spectral decay is associated to the characterization of the norm of θ\theta when a function ff can be represented as f(x)=⟨θ,φ(x)⟩f(x) = \langle \theta, \varphi(x) \rangle. This norm depends precisely on the L2L_2-norms of derivatives of ff (see [22] and [1, Chapter 7]).

In order to have a nice list of examples, we can easily go back and forth between qq and its Fourier coefficients (q^ω)ω∈Z(\hat{q}_\omega)_{\omega \in \mathbb{Z}} for a variety of situations. Below we start with q^\hat{q} and give the expression of qq.

  • Bernoulli polynomials: q^0=π2/3\hat{q}_0 = \pi^2/3, q^ω=∣ω∣−2s\hat{q}_\omega = |\omega|^{-2s} when ω≠0\omega \neq 0, for ss strictly positive integer. We can then show that (see, e.g., [22])
    q(x)=π23+(−1)s−1(2π)2s(2s)!B2s({x}),q(x) = \frac{\pi^2}{3} + (-1)^{s-1} \frac{(2\pi)^{2s}}{(2s)!}B_{2s}(\{x\}),
    where {x}=x–⌊x⌋∈[0,1)\{x\} = x – \lfloor x \rfloor \in [0,1) is the fractional part of xx, and B2sB_{2s} the (2s)(2s)-th Bernoulli polynomial. For example, for s=1s=1, we obtain q(x)=π23–2π2{x}+2π2{x}2q(x) = \frac{\pi^2}{3} – 2\pi^2 \{x\} + 2\pi^2 \{x\}^2, which is a degree-two polynomial in {x}\{x\}. These kernels are useful to study different decays of eigenvalues of the form m−αm^{-\alpha} for α\alpha an even integer.
  • Hyperbolic functions: q^(ω)=11+ω2α2\hat{q}(\omega) = \frac{1}{1+\omega^2 \alpha^2}, with then the explicit formula (obtained in an earlier blog post on residue calculus):
    q(x)=π/αsinh⁡(π/α)cosh⁡(πα(1–2∣{t+1/2} ⁣− ⁣1/2∣)).q(x) = \frac{\pi/\alpha}{\sinh (\pi/\alpha)} \cosh \big(\frac{\pi}{\alpha} (1 – 2 | \{t+1/2\}\!-\! 1/2| ) \big).
    This kernel is useful as it leads to a Sobolev space with squared norm which is explicitly the sum of L2L_2-derivatives of the function and its derivative, and thus related to the Abel kernel.
  • Exponential decay: q^(ω)=ρ∣ω∣\hat{q}(\omega) = \rho^{|\omega|} for ρ∈(0,1)\rho \in (0,1), for which we have by using sums of geometric series:
    q(x)=1−ρ21+ρ2 –2ρcos⁡(2πx).(2)q(x) = \frac{1-\rho^2}{1+\rho^2 \, – 2\rho \cos(2\pi x)}.\tag{2}

We can now extend the one-dimensional torus [0, ⁣1][0,\! 1] to dd dimensions.

From [0, ⁣1][0,\! 1] to [0, ⁣1]d[0,\! 1]^d

We consider kernels of the form k(x,y)=q(x−y)k(x,y)=q(x-y) for qq a 11-periodic function, that is, for which q(x+z)=q(x)q(x+z)=q(x) for any vector z∈Zdz \in \mathbb{Z}^d. For the uniform distribution on [0, ⁣1]d[0,\! 1]^d, like in one dimension, the functions x↦e2iπω⊤xx \mapsto e^{2i\pi \omega^\top x}, for ω∈Zd\omega \in \mathbb{Z}^d, form an orthonormal basis of square-integrable functions. By using multi-dimensional Fourier series, we can decompose

q(x)=∑ω∈Zdq^ωe2iπω⊤(x−y).q(x) = \sum_{\omega \in \mathbb{Z}^d} \hat{q}_\omega e^{2i\pi\omega^\top(x-y)}.
Eigenvalues are then q^ω\hat{q}_\omega for ω∈Zd\omega \in \mathbb{Z}^d. Thus, eigenvalues also come at least by pairs, as we also have q^−ω=q^ω\hat{q}_{-\omega} = \hat{q}_\omega, but as we will see below, they can coalesce even more.

A particularly interesting and common case corresponds to product kernels of the form

q^ω=∏j=1dr^ωj,\hat{q}_\omega = \prod_{j=1}^d \hat{r}_{\omega_j},
where rr is a positive definite function on [0, ⁣1][0,\! 1] (that is, r^ω⩾0\hat{r}_\omega \geqslant 0 for all ω∈Z\omega \in \mathbb{Z}), since then
q(x)=∏j=1dr(xj).q(x) = \prod_{j=1}^d r(x_j).
Depending on the Fourier series (r^ω)ω∈Z(\hat{r}_{\omega})_{\omega \in \mathbb{Z}}, eigenvalues can coalesce beyond coming by pairs. For example, when r^ω=ρ∣ω∣\hat{r}_{\omega}= \rho^{|\omega|}, then eigenvalues of Σ\Sigma are ρ∥ω∥1\rho^{\| \omega \|_1}, where ∥ω∥1\| \omega \|_1 is the ℓ1\ell_1-norm of ω\omega. Thus, all eigenvalues have a known multiplicity, that is, the eigenvalue ρr\rho^{r} for rr non-negative integer, has a multiplicity equal to the number n(d,r)n(d,r) of ω∈Zd\omega \in \mathbb{Z}^d such that ∥ω∥1=r\|\omega\|_1 = r. For d=1d=1, we recover the sequence above, since n(1,0)=1n(1,0)=1 and n(1,r)=2n(1,r)=2 for r⩾1r\geqslant 1. When d⩾1d \geqslant 1, I am not aware of a general formula (please let me know if you know one, see [23] for some results), but one can show (see the end of the post) that n(d,r)∼2r(dr)n(d,r) \sim 2^r { d \choose r} when d→+∞d \to +\infty, and n(d,r)∼2d(d−1)!rd−1n(d,r)\sim \frac{2^d}{(d-1)!} r^{d-1} when r→+∞r \to +\infty. We then obtain the eigenvalues plotted below, where we see the various discrete levels. Note that here log⁡1λm\log \frac{1}{\lambda_m} is of order log⁡1ρ⋅m1/d\log \frac{1}{\rho} \cdot m^{1/d} (see [9, Section 2.3]).

Exponential decay kernel. Left: 4000 observations in the unit cube [0, ⁣1]2[0,\! 1]^2. Right: ordered eigenvalues in log-scale for the translation-invariant kernel defined as k(x,y)=∏j=12 ⁣1−ρ21+ρ2–2ρcos⁡(2πxj)k(x,y) = \prod_{j=1}^2 \! \frac{1-\rho^2}{1+\rho^2 – 2\rho \cos(2\pi x_j)}. Ten replications are plotted as a video.

For the Fourier series r^ω=1/(1 ⁣+ ⁣∣ω∣2)\hat{r}_\omega = {1}/ (1\!+\!|\omega|^2), eigenvalues coalesce less, as shown below. It is however possible to show that λm\lambda_m is of order (log⁡m)2/m2{(\log m)^2}/{m^2} (see [9, Section 2.3]).

Sobolev kernel. Left: 4000 observations in the unit cube [0, ⁣1]2[0,\! 1]^2. Right: ordered eigenvalues in log-log-scale for the translation-invariant kernel defined k(x,y)=∏j=12q(xj)k(x,y) = \prod_{j=1}^2 q(x_j) where qq is defined in Eq. (2)(2). Ten replications are plotted as a video.

Conclusion

In this blog post, we first showed how large kernel matrices had eigenvalues that tend to the eigenvalues of the (typically infinite-dimensional) covariance operator, at rate O(1/n)O(1/\sqrt{n}) where nn is the number of observations, with a new improved multiplicative bound for smaller eigenvalues.

We then studied a class of pairs (kernel, input distribution) that led to exact expressions for these eigenvalues, namely, translation-invariant kernels on [0, ⁣1]d[0,\! 1]^d. However, these kernels are rarely used in practice. The goal of the next blog post will be to consider generic probability distributions on Rd\mathbb{R}^d and translation-invariant kernels of the form k(x,y)=q(x−y)k(x,y) =q(x-y) with qq a function with non-negative Fourier transform. No closed form any more in general (except for Gaussians), so not as easy, but nice approximations are possible!

References

[1] Francis Bach. Learning Theory from First principles. Book draft, 2024. [2] Christopher Williams, Matthias Seeger. Using the Nyström method to speed up kernel machines. Advances in Neural Information Processing Systems, 2000. [3] Shai Fine, Katya Scheinberg. Efficient SVM training using low-rank kernel representations. Journal of Machine Learning Research, 2:243-264, 2001. [4] Francis Bach, Michael I. Jordan. Kernel independent component analysis. Journal of Machine Learning Research, 3:1-48, 2002. [5] Michael W. Mahoney, Petros Drineas. CUR matrix decompositions for improved data analysis. Proceedings of the National Academy of Sciences, 106(3):697-702, 2009. [6] Ali Rahimi, Benjamin Recht. Random features for large-scale kernel machines. Advances in Neural Information Processing Systems, 2007. [7] Francis Bach. Sharp analysis of low-rank kernel matrix approximations. Conference on learning theory, 2013. [8] Ahmed El Alaoui, Michael W. Mahoney. Fast randomized kernel ridge regression with statistical guarantees. Advances in Neural Information Processing Systems, 2015. [9] Francis Bach. On the equivalence between kernel quadrature rules and random feature expansions. Journal of Machine Learning Research, 18(1):714-751, 2017. [10] Alessandro Rudi, Lorenzo Rosasco. Generalization properties of learning with random features. Advances in Neural Information Processing Systems, 2017. [11] Aymeric Dieuleveut, Nicolas Flammarion, Francis Bach. Harder, Better, Faster, Stronger Convergence Rates for Least-Squares Regression. Journal of Machine Learning Research, 18(101):1-51, 2017. [12] Raphaël Berthier, Francis Bach, Pierre Gaillard. Accelerated Gossip in Networks of Given Dimension using Jacobi Polynomial Iterations. SIAM Journal on Mathematics of Data Science, 2(1):24-47, 2020. [13] Fabian Pedregosa, Damien Scieur. Acceleration through spectral density estimation. International Conference on Machine Learning, 2020. [14] Noureddine El Karoui. The Spectrum of Kernel Random Matrices. Annals of Statistics, 38(1): 1-50, 2010. [15] Simon Barthelmé, Konstantin Usevich. Spectral properties of kernel matrices in the flat limit. SIAM Journal on Matrix Analysis and Applications, 42(1):17-57, 2021. [16] Andrea Caponnetto, Ernesto De Vito. Optimal rates for the regularized least-squares algorithm. Foundations of Computational Mathematics, 7:331-368, 2007. [17] Bhatia, Rajendra, Ludwig Elsner. The Hoffman-Wielandt inequality in infinite dimensions. Proceedings of the Indian Academy of Sciences (Mathematical Sciences), 104(3):483:494, 1994. [18] Stanislav Minsker. On some extensions of Bernstein’s inequality for self-adjoint operators. Statistics and Probability Letters, 127:111-119, 2017. [19] Joell A. Tropp. An Introduction to Matrix Concentration Inequalities. Foundations and Trends in Machine Learning, 8(1-2):1-230, 2015. [20] Mikio L. Braun. Accurate error bounds for the eigenvalues of the kernel matrix. Journal of Machine Learning Research, 7:2303-2328, 2006. [21] Vladimir Koltchinskii and Evarist Giné. Random matrix approximation of spectra of integral operators. Bernoulli, 6(1):113–167, 2000. [22] Grace Wahba. Spline Models for Observational Data. Society for industrial and applied mathematics, 1990. [23] Patrick Solé. Counting lattice points in pyramids. Discrete mathematics, 139(1-3): 381-392, 1995. [24] Francis Bach. Information theory with kernel methods. IEEE Transactions on Information Theory, 69(2):752-775, 2022. [25] Dmitrii M. Ostrovskii, Alessandro Rudi. Affine invariant covariance estimation for heavy-tailed distributions. Conference on Learning Theory, 2019.

Infinite-dimensional bound on operator norm

Given a feature map φ:X→H\varphi: \mathcal{X} \to \mathcal{H} such that ∥φ(x)∥⩽R\| \varphi(x)\| \leqslant R almost surely. We have from [19, Theorem 7.7.1], for any δ∈(0,1)\delta \in (0,1), with probability greater than 1–δ1 – \delta:

∥Σ –Σ^∥op⩽2R23nlog⁡8dδ+2R2n∥Σ∥oplog⁡8dδ,\| \Sigma\, – \hat\Sigma \|_{\rm op} \leqslant \frac{2R^2}{3n} \log \frac{8d}{\delta} + \sqrt{ \frac{2R^2}{n} \| \Sigma\|_{\rm op} \log \frac{8d}{\delta}},
with d=tr(Σ)∥Σ∥opd = \frac{ {\rm tr}(\Sigma)}{\| \Sigma\|_{\rm op}} is referred to as the intrinsic dimension of Σ\Sigma (as originally defined by [18]). This already leads to an improved bound compared to the Hilbert-Schmidt one we proposed earlier.

Moreover, this is often applied to (Σ+λI)−1/2φ(\Sigma+\lambda I)^{-1/2} \varphi (see, e.g., [10]), leading to, with a probability greater than 1−δ1-\delta:

∥(Σ+λI)−1/2(Σ –Σ^)(Σ+λI)−1/2∥op⩽2df(λ)3nlog⁡8dδ+2df(λ)nlog⁡8dδ,\| (\Sigma+\lambda I)^{-1/2} ( \Sigma\, – \hat\Sigma) (\Sigma+\lambda I)^{-1/2}\|_{\rm op} \leqslant \frac{2 {\rm df}(\lambda) }{3n} \log \frac{8d}{\delta} + \sqrt{ \frac{2{\rm df}(\lambda)}{n} \log \frac{8d}{\delta}},
with d=df(λ)(1+λ∥Σ∥op)⩽R2λ(1+λ∥Σ∥op)⩽2R2λd = {\rm df}(\lambda) \big( 1 + \frac{\lambda}{\| \Sigma\|_{\rm op} }\big) \leqslant \frac{R^2}{\lambda} \big( 1 + \frac{\lambda}{\| \Sigma\|_{\rm op} }\big) \leqslant \frac{2R^2}{\lambda} if λ⩽∥Σ∥op\lambda \leqslant \| \Sigma\|_{\rm op}, where we already defined the maximal degrees of freedom as df(λ)=sup⁡x∈X⟨φ(x),(Σ+λI)−1φ(x)⟩{\rm df}(\lambda) = \sup_{x \in \mathcal{X}} \langle \varphi(x), (\Sigma+\lambda I)^{-1} \varphi(x) \rangle. Under regularity conditions explained in the post (bounded eigenfunctions), df(λ){\rm df}(\lambda) has the same order as the regular degrees of freedom tr[Σ(Σ+λI)−1]{\rm tr} [ \Sigma(\Sigma+\lambda I)^{-1} ] when λ\lambda tends to zero. The dominant term is then df(λ)n\sqrt{ \frac{{\rm df}(\lambda)}{n}} up to logarithmic terms.

Multiplicative eigenvalue bounds

We aim to bound ∥log⁡(Σ ⁣+ ⁣λI)−log⁡(Σ^ ⁣+ ⁣λI)∥op\| \log (\Sigma \!+\! \lambda I)- \log (\hat \Sigma \!+\! \lambda I)\|_{\rm op} by ε\varepsilon, which will lead to a bound of the form

∣log⁡(λm(Σ) ⁣+ ⁣λ) –log⁡(λm(Σ^) ⁣+ ⁣λ)∣⩽∥log⁡(Σ ⁣+ ⁣λI)−log⁡(Σ^ ⁣+ ⁣λI)∥op⩽ε,| \log( \lambda_m(\Sigma)\!+\!\lambda)\, – \log( \lambda_m(\hat\Sigma)\!+\!\lambda)| \leqslant \| \log (\Sigma \!+\! \lambda I)- \log (\hat \Sigma \!+\! \lambda I)\|_{\rm op} \leqslant \varepsilon,
which in turn leads to bounds for each eigenvalues:
∣λm(Σ) –λm(Σ^)∣⩽(λm(Σ)+λ)(eε–1),| \lambda_m(\Sigma) \, – \lambda_m(\hat\Sigma) | \leqslant (\lambda_m(\Sigma) +\lambda) ( e^\varepsilon – 1),
which are multiplicative up to the factor λ\lambda. Since, up to logarithmic factors, ε≈df(λ)n\varepsilon \approx \sqrt{ \frac{{\rm df}(\lambda)}{n}}, we get (up to logarithmic terms)
∣λm(Σ) –λm(Σ^)∣⩽(λm(Σ)+λ)df(λ)n.| \lambda_m(\Sigma) \, – \lambda_m(\hat\Sigma) | \leqslant (\lambda_m(\Sigma) +\lambda) \sqrt{ \frac{{\rm df}(\lambda)}{n}}.
Thus, overall, it all depends on how df(λ){\rm df}(\lambda) tends to infinity when λ\lambda tends to zero, which is exactly what can be obtained from results in this and next blog post. A natural choice is λ∼λm(Σ)\lambda \sim \lambda_m(\Sigma), and for “well-behaved” cases (such as λm∼Cm−α\lambda_m \sim C m^{-\alpha}), then df(λm)∼m{\rm df}(\lambda_m) \sim m, leading to the multiplicative bound ∣λm(Σ) –λm(Σ^)∣⩽λm(Σ)mn| \lambda_m(\Sigma) \, – \lambda_m(\hat\Sigma) | \leqslant \lambda_m(\Sigma) \sqrt{ \frac{m}{n}}, which is an improvement over results [20], that do not lead to multiplicative bounds in O(1/n)O(1/\sqrt{n}).

Details of the bound. We assume that λ\lambda is chosen so that λ⩽∥Σ∥op⩽R2\lambda \leqslant \| \Sigma\|_{\rm op} \leqslant R^2, n⩾9n \geqslant 9, and

df(λ)n⋅log⁡16R2λδ⋅(log⁡R2nλ)2⩽18.\frac{{\rm df}(\lambda) }{n} \cdot \log \frac{16 R^2}{ \lambda \delta} \cdot \big( \log \frac{R^2 \sqrt{n}}{\lambda} \big)^2 \leqslant \frac{1}{8}.

This is possible as soon 1nR2∥Σ∥op⋅log⁡16R2∥Σ∥opδ(log⁡R2n∥Σ∥op)2⩽18\frac{1}{n} \frac{R^2}{\| \Sigma \|_{\rm op}} \cdot \log \frac{16 R^2}{ \| \Sigma \|_{\rm op} \delta} \big( \log \frac{R^2 \sqrt{n}}{\| \Sigma \|_{\rm op}} \big)^2 \leqslant \frac{1}{8}, and thus for nn large enough. Note also that this implies df(λ)⩾1/2{\rm df}(\lambda) \geqslant 1/2.

This first implies from the bound above that with probability greater than 1−δ1-\delta,

∥(Σ ⁣+ ⁣λI)−1/2(Σ –Σ^)(Σ ⁣+ ⁣λI)−1/2∥op⩽t,(3)\| (\Sigma\!+\!\lambda I)^{-1/2} ( \Sigma\, – \hat\Sigma) (\Sigma\!+\! \lambda I)^{-1/2}\|_{\rm op} \leqslant t, \tag{3}
with t⩽34t \leqslant \frac{3}{4} and t⩽2df(λ)nlog⁡16R2λδt \leqslant 2 \sqrt{ \frac{{\rm df}(\lambda)}{n} \log \frac{16 R^2}{ \lambda \delta}}.

We then have by an integration which is similar to the proof of operator monotonicity of the logarithm (see this post) and already used in a similar context in [24],

log⁡(Σ ⁣+ ⁣λI) –log⁡(Σ^ ⁣+ ⁣λI)=∫λ∞[(Σ^ ⁣+ ⁣μI)−1–(Σ ⁣+ ⁣μI)−1]dμ.\log (\Sigma \!+\! \lambda I) \, – \log (\hat\Sigma \!+\! \lambda I) = \int_\lambda^{\infty} \big[ (\hat\Sigma \!+\! \mu I)^{-1} – (\Sigma \!+\! \mu I)^{-1} \big] d\mu.
In order to bound the integrand above, we use the classical identity
(Σ^ ⁣+ ⁣μI)−1–(Σ ⁣+ ⁣μI)−1=(Σ^ ⁣+ ⁣μI)−1(Σ –Σ^)(Σ ⁣+ ⁣μI)−1,(\hat\Sigma \!+\! \mu I)^{-1} – (\Sigma \!+\! \mu I)^{-1} = (\hat\Sigma \!+\! \mu I)^{-1} (\Sigma \, – \hat\Sigma) (\Sigma \!+\! \mu I)^{-1},
and the associated bound
∥(Σ^ ⁣+ ⁣μI)−1–(Σ ⁣+ ⁣μI)−1∥op⩽1μ∥(Σ^ ⁣+ ⁣μI)−1/2(Σ –Σ^)(Σ ⁣+ ⁣μI)−1/2∥op.\| (\hat\Sigma \!+\! \mu I)^{-1} – (\Sigma \!+\! \mu I)^{-1}\|_{\rm op} \leqslant \frac{1}{\mu} \| (\hat\Sigma \!+\! \mu I)^{-1/2} (\Sigma \, – \hat\Sigma) (\Sigma \!+\! \mu I)^{-1/2}\|_{\rm op}.
We can now use our approximation in Eq. (3)(3) with t⩽34t \leqslant \frac{3}{4} in a standard way in the analysis of kernel methods (see,e.g., [10]), that is,
∥(Σ^ ⁣+ ⁣μI)−1/2(Σ ⁣+ ⁣μI)1/2∥op⩽11−t⩽2.\| (\hat\Sigma \!+\! \mu I)^{-1/2} (\Sigma \!+\! \mu I)^{1/2} \|_{\rm op} \leqslant \frac{1}{\sqrt{1-t}} \leqslant 2.
Thus, for μ∈[λ,R2n]\mu \in [\lambda, R^2 \sqrt{n}], we can bound
∥(Σ^+μI)−1–(Σ+μI)−1∥op⩽1μt1−t⩽2tμ,\| (\hat\Sigma + \mu I)^{-1} – (\Sigma + \mu I)^{-1} \|_{\rm op} \leqslant \frac{1}{\mu} \frac{t}{\sqrt{1-t}} \leqslant \frac{2 t}{\mu},
while for μ⩾R2n\mu \geqslant R^2 \sqrt{n}, we bound
∥(Σ^ ⁣+ ⁣μI)−1–(Σ ⁣+ ⁣μI)−1∥op⩽1μ2∥Σ^−Σ∥op⩽2R2μ2.\| (\hat\Sigma \!+\! \mu I)^{-1} – (\Sigma \!+\! \mu I)^{-1} \|_{\rm op} \leqslant \frac{1}{\mu^2} \|\hat\Sigma-\Sigma\|_{\rm op} \leqslant \frac{2R^2}{\mu^2}.
Thus, by integrating the bounds and using the triangular inequality, we get:
∥log⁡(Σ ⁣+ ⁣λI) –log⁡(Σ^ ⁣+ ⁣λI)∥op⩽∫λR2n2tμdμ+∫R2n2R2μ2dμ.\| \log (\Sigma \!+\! \lambda I) \, – \log (\hat\Sigma \!+\! \lambda I)\|_{\rm op} \leqslant \int_\lambda^{R^2\sqrt{n}} \frac{2t}{\mu}d\mu + \int_{R^2\sqrt{n}}\frac{2R^2}{\mu^2} d\mu.
This leads to
∥log⁡(Σ+λI) –log⁡(Σ^+λI)∥op⩽2tlog⁡R2nλ+2n.\| \log (\Sigma + \lambda I) \, – \log (\hat\Sigma + \lambda I)\|_{\rm op} \leqslant {2t} \log \frac{R^2 \sqrt{n}}{\lambda} + \frac{2}{\sqrt{n}}.
We thus get the bound using Eq. (3)(3)
∥log⁡(Σ+λI) –log⁡(Σ^+λI)∥op⩽1n(2+2log⁡R2nλdf(λ)log⁡16R2λδ).\| \log (\Sigma + \lambda I) \, – \log (\hat\Sigma + \lambda I)\|_{\rm op} \leqslant \frac{1}{\sqrt{n}} \big( 2 + 2 \log \frac{R^2 \sqrt{n}}{\lambda} \sqrt{ {\rm df}(\lambda) \log\frac{16 R^2}{ \lambda \delta} }\big).
Thus, since we have assumed that n⩾9n \geqslant 9 and
df(λ)n⋅log⁡16R2λδ⋅( ⁣log⁡R2nλ)2⩽1/8,\frac{{\rm df}(\lambda) }{n} \cdot \log\frac{16 R^2}{ \lambda \delta} \cdot \big(\! \log \frac{R^2 \sqrt{n}}{\lambda} \big)^2 \leqslant 1/8,
the bound above is less than 2/3+2/2⩽3/22/3 + \sqrt{2}/2 \leqslant 3/2, so that the value ε\varepsilon above is less than 3/23/2, which implies that eε–1⩽(5/2)εe^\varepsilon – 1 \leqslant (5/2) \varepsilon. Using that all logarithmic terms are greater than 11, and that df(λ)⩾1/2{\rm df}(\lambda) \geqslant 1/2, we then obtain the bound
∣λm(Σ) –λm(Σ^)∣⩽9(λm(Σ)+λ)df(λ)n⋅log⁡R2nλ⋅log⁡16R2λδ.| \lambda_m(\Sigma) \, – \lambda_m(\hat\Sigma) | \leqslant 9 (\lambda_m(\Sigma) +\lambda)\sqrt{\frac{{\rm df}(\lambda) }{n}} \cdot\log \frac{R^2 \sqrt{n}}{\lambda} \cdot \sqrt{ \log \frac{16 R^2}{ \lambda \delta}}.

(added January 9, 2024) Simpler argument. As mentioned to me by Alessandro, there is a simpler way of obtaining a slightly sharper result coming from [25, Corollary 12]. Starting from Eq. (3)(3), we get

−t(Σ ⁣+ ⁣λI)≼Σ^ –Σ≼t(Σ ⁣+ ⁣λI),-t ( \Sigma \! + \! \lambda I) \preccurlyeq \hat{\Sigma} \, – \Sigma \preccurlyeq t ( \Sigma \! + \! \lambda I),
which directly implies that for all m⩾0m \geqslant 0,
−t(λm(Σ) ⁣+ ⁣λ)⩽λm(Σ^) –λm(Σ)⩽t(λm(Σ) ⁣+ ⁣λ),-t ( \lambda_m(\Sigma) \! + \! \lambda ) \leqslant \lambda_m(\hat{\Sigma}) \, – \lambda_m(\Sigma) \leqslant t ( \lambda_m(\Sigma) \! + \! \lambda),
and thus ∣λm(Σ^) –λm(Σ)∣⩽(λm(Σ) ⁣+ ⁣λ)⋅2df(λ)n⋅log⁡16R2λδ.| \lambda_m(\hat{\Sigma}) \, – \lambda_m(\Sigma)| \leqslant ( \lambda_m(\Sigma) \! + \! \lambda) \cdot 2 \sqrt{ \frac{{\rm df}(\lambda)}{n}} \cdot \sqrt{ \log \frac{16 R^2}{ \lambda \delta}}.

Analysis of n(d,r)n(d,r)

As defined above, n(d,r)n(d,r) is the number of ω∈Zd\omega \in \mathbb{Z}^d such that ∥ω∥1=r\|\omega\|_1 = r. We have by direct inspection n(d,0)=1n(d,0)=1 and n(d,1)=2dn(d,1) = 2d for all d⩾1d \geqslant 1. We can use the classical result that the number of ω∈Nd\omega \in \mathbb{N}^d such that ∥ω∥1=r\|\omega\|_1 = r (that is only non-negative integers) is equal to (d+s−1d−1){ d+s-1 \choose d-1}, and isolate the set A⊂{1,…,d}A \subset \{1,\dots,d\} for which the components of ω\omega are strictly positive, we then get:

n(d,r)=∑A⊂{1,…,d}, 1⩽∣A∣⩽s2∣A∣(s−1∣A∣−1)=∑k=1s2k(s−1k−1)(dk).n(d,r)=\sum_{A \subset \{1,\dots,d\}, \, 1 \leqslant |A| \leqslant s} 2^{|A|}{ s-1 \choose |A|-1}=\sum_{k=1}^s 2^k { s-1 \choose k-1} { d \choose k}.

From the expansion above, we get the equivalent n(d,r)∼2r(dr)n(d,r) \sim 2^r { d \choose r} when d→+∞d \to +\infty. In order to obtain the equivalent n(d,r)∼2d(d−1)!rd−1n(d,r)\sim \frac{2^d}{(d-1)!} r^{d-1} when r→+∞r \to +\infty, we can derive a recursion between n(d,r)n(d,r) and the values n(d−1,s)n(d-1,s) for s⩽rs \leqslant r, that is, for r⩾1r\geqslant 1,

n(d,r)=2+n(d−1,r)+2∑s=1r−1n(d−1,s),n(d,r) = 2 + n(d-1,r) + 2 \sum_{s=1}^{r-1} n(d-1,s),
which can be obtained by looking at all potential values of ∣ωd∣|\omega_d|, from 00 to rr.