Just Interpolate: Kernel "Ridgeless" Regression Can Generalize
Tengyuan Liang, Alexander Rakhlin
Introduction
According to conventional wisdom, explicit regularization should be added to the least-squares objective when the Hilbert space is high- or infinite-dimensional (Golub et al., 1979; Wahba, 1990; Smola and Schölkopf, 1998; Shawe-Taylor and Cristianini, 2004; Evgeniou et al., 2000; De Vito et al., 2005; Alvarez et al., 2012):
The regularization term is introduced to avoid “overfitting” since kernels provide enough flexibility to fit training data exactly (i.e. interpolate it). From the theoretical point of view, the regularization parameter is a knob for balancing bias and variance, and should be chosen judiciously. Yet, as noted by a number of researchers in the last few years,In particular, we thank M. Belkin, B. Recht, L. Rosasco, and N. Srebro for highlighting this phenomenon. the best out-of-sample performance, empirically, is often attained by setting the regularization parameter to zero and finding the minimum-norm solution among those that interpolate the training data. The mechanism for good out-of-sample performance of this interpolation method has been largely unclear (Zhang et al., 2016; Belkin et al., 2018b).
As a concrete motivating example, consider the prediction performance of Kernel Ridge Regression for various valuesWe take . of the regularization parameter on subsets of the MNIST dataset. For virtually all pairs of digits, the best out-of-sample mean squared error is achieved at . Contrary to the standard bias-variance-tradeoffs picture we have in mind, the test error is monotonically decreasing as we decrease (see Figure 1 and further details in Section 6).
We isolate what appears to be a new phenomenon of implicit regularization for interpolated minimum-norm solutions in Kernel “Ridgeless” Regression. This regularization is due to the curvature of the kernel function and “kicks in” only for high-dimensional data and for “favorable” data geometry. We provide out-of-sample statistical guarantees in terms of spectral decay of the empirical kernel matrix and the empirical covariance matrix, under additional technical assumptions.
Our analysis rests on the recent work in random matrix theory. In particular, we use a suitable adaptation of the argument of (El Karoui, 2010) who showed that high-dimensional random kernel matrices can be approximated in spectral norm by linear kernel matrices plus a scaled identity. While the message of (El Karoui, 2010) is often taken as “kernels do not help in high dimensions,” we show that such a random matrix analysis helps in explaining the good performance of interpolation in Kernel “Ridgeless” Regression.
Grace Wahba (Wahba, 1990) pioneered the study of nonparametric regression in reproducing kernel Hilbert spaces (RKHS) from the computational and statistical perspectives. One of the key aspects in that work is the role of the decay of eigenvalues of the kernel (at the population level) in rates of convergence. The analysis relies on explicit regularization (ridge parameter ) for the bias-variance trade-off. The parameter is either chosen to reflect the knowledge of the spectral decay at the population level (De Vito et al., 2005) (typically unknown to statistician), or by the means of cross-validation (Golub et al., 1979). Interestingly, the explicit formula of Kernel Ridge Regression has been introduced as “kriging” in the literature before, and was widely used in Bayesian statistics (Cressie, 1990; Wahba, 1990).
In the learning theory community, Kernel Ridge Regression is known as a special case of Support Vector Regression (Vapnik, 1998; Shawe-Taylor and Cristianini, 2004; Vovk, 2013). Notions like metric entropy (Cucker and Smale, 2002) or “effective dimension” (Caponnetto and De Vito, 2007) were employed to analyze the guarantees on the excess loss of Kernel Ridge Regression, even when the model is misspecified. We refer the readers to Györfi et al. (2006) for more details. Again, the analysis leans crucially on the explicit regularization, as given by a careful choice of , for the model complexity and approximation trade-off, and mostly focusing on the fixed dimension and large sample size setting. However, to the best of our knowledge, the literature stays relatively quiet in terms of what happens to the minimum norm interpolation rules, i.e., . As pointed out by (Belkin et al., 2018b, a), the existing bounds in nonparametric statistics and learning theory do not apply to interpolated solution either in the regression or the classification setting. In this paper, we aim to answer when and why interpolation in RKHS works, as a starting point for explaining the good empirical performance of interpolation using kernels in practice (Zhang et al., 2016; Belkin et al., 2018b).
Preliminaries
In this paper we study the case when is full rank, taking (2.2) as the starting point. For this interpolating estimator, we provide high-probability (with respect to a draw of ) upper bounds on the integrated squared risk of the form
Here the expectation is over and , and is a data-dependent upper bound. We remark that upper bounds of the form (2.3) also imply prediction loss bounds for excess square loss with respect to the class , as .
2 Notation and Background on RKHS
Let us introduce the integral operator with respect to the marginal measure :
and denote the set of eigenfunctions of this integral operator by , where could be . We have that
Denote as the collection of non-negative eigenvalues. Adopting the spectral notation,
Via this spectral characterization, the interpolation estimator (2.1) takes the following form
and the associated eigenvalues to be , indexed by . The eigenvalues are the same as those of . It is sometimes convenient to express as the linear operator under the basis of eigenfunctions, in the following matrix sense
We write to denote the expectation with respect to the marginal . Furthermore, we denote by
the squared norm with respect to the marginal distribution. The expectation denotes the expectation over conditionally on .
Main Result
High dimensionality: there exists universal constants such that . Denote by the covariance matrix, assume that the operator norm .
Noise condition: there exists a such that for all .
Non-linear kernel: for any , . Furthermore, we consider the inner-product kernels of the form
While we state the main theorem for inner product kernels, the results follow under suitable modificationsWe refer the readers to El Karoui (2010) for explicit extensions to RBF kernels. for Radial Basis Function (RBF) kernels of the form
We postpone the discussion of the assumptions until after the statement of the main theorem.
Let us first define the following quantities related to curvature of :
Under the assumptions (A.1)-(A.4) and for large enough, with probability at least (with respect to a draw of design matrix ), the interpolation estimator (2.2) satisfies
Here the remainder term .
A few remarks are in order. First, the upper bound is data-dependent and can serve as a certificate (assuming that an upper bound on can be guessed) that interpolation will succeed. The bound also suggests the regimes when the interpolation method should work. The two terms in the estimate of Theorem 1 represent upper bounds on the variance and bias of the interpolation estimator, respectively. Unlike the explicit regularization analysis (e.g. (Caponnetto and De Vito, 2007)), the two terms are not controlled by a tunable parameter . Rather, the choice of the non-linear kernel itself leads to an implicit control of the two terms through curvature of the kernel function, favorable properties of the data, and high dimensionality. We remark that for the linear kernel (), we have , and the bound on the variance term can become very large in the presence of small eigenvalues. In contrast, curvature of introduces regularization through a non-zero value of . We also remark that the bound “kicks in” in the high-dimensional regime: the error term decays with both and .
We left the upper bound of Theorem 1 in a data-dependent form for two reasons. First, an explicit dependence on the data tells us whether interpolation can be statistically sound on the given dataset. Second, for general spectral decay, current random matrix theory falls short of characterizing the spectral density non-asymptotically except for special cases (Bose et al., 2003; El Karoui, 2010).
The assumption in (A.1) that emphasizes that we work in a high-dimensional regime where scales on the order of . This assumption is used in the proof of (El Karoui, 2010), and the particular dependence on can be traced in that work if desired. Rather than doing so, we “folded” these constants into mild additional power of . The same goes for the assumption on the scaling of the trace of the population covariance matrix.
The assumption in (A.2) that are i.i.d. across is a strong assumption that is required to ensure the favorable high-dimensional effect. Relaxing this assumption is left for future work.
The existence of -moments for is enough to ensure for almost surely (see, Lemma 2.2 in Yin et al. (1988)). Remark that the assumption of existence of -moments in (A.2) is relatively weak. In particular, for bounded or subgaussian variables, and the error term scales as , up to log factors. See Lemma B.1 for an explicit calculation in the Gaussian case.
Finally, as already mentioned, the main result is stated for the inner product kernel, but can be extended to the RBF kernel using an adaptation of the analysis in (El Karoui, 2010).
Behavior of the Data-dependent Bound
We can further bound the variance and the bias, with the choice , as
We first illustrate numerically the bias-variance trade-off by varying the geometric properties of the data in terms of the population spectral decay of . We shall parametrize the eigenvalues of the covariance, for , as
The parameter controls approximate “low-rankness” of the data: the closer is to , the faster does the spectrum of the data decay. This is illustrated in the top row of Figure 6 on page 6. By letting , can be arbitrary small, as
We will focus on three cases, , for the decay parameter, and values , . The data-dependent upper bounds on and are summarized in Table 1. More detailed plots are postponed to Figure 6 (in this figure, we plot the ordered eigenvalues and the spectral density for both the population and empirical covariances). Table 1 shows that as increases (a slower spectral decay), the implicit regularization parameter becomes larger, resulting in a decreasing variance and an increasing bias.
We also perform simulations to demonstrate the trade-off between bias and variance in the generalization error. The result is shown in Figure 2. For each choice of pair, we vary the spectral decay of the kernel by changing gradually , and plot the generalization error on the log scale. We postpone the experiment details to Section 6.2, but point out important phenomenona observed in Figures 2-3: (1) an extremely fast spectral decay (small ) will generate insufficient implicit regularization that would hurt the generalization performance due to a large variance term; (2) a very slow spectral decay (large ) will result in a large bias, which can also hurt the generalization performance; (3) certain favorable spectral decay achieves the best trade-off, resulting in the best generalization error.
We now theoretically demonstrate scalings within the regime when both and vanish. For simplicity, we consider Gaussian .
Consider general eigenvalue decay with . Then with high probability,
To illustrate the behavior of the estimates in Corollary 4.1, consider the following assumptions on the population covariance matrix:
Let with ones, . In this case , and with high probability by standard results in random matrix theory. Then
Therefore, as , both terms vanish for .
Let for small . In this case, and with high probability. Then
For instance, for , both terms vanish for .
Consider for . Then . One can bound w.h.p. (see (B.4))
Balancing the two terms, one obtains a nonparametric upper bound A similar analysis can be carried out for .
Case d>n𝑑𝑛d>n
In this case, we can further bound the variance and the bias, with the choice , as
We first numerically illustrate the trade-off between the variance and the bias upper bounds. We consider three cases , and , . As before, we find a trade-off between and with varying ; the results are summarized in Table 2. Additionally, Figure 7 provides a plot of the ordered eigenvalues, as well as spectral density for both the population and empirical covariances. As one can see, for a general eigenvalue decay, the spectral density of the population and the empirical covariance can be quite distinct. We again plot the generalization error in Figure 3 as a function of .
We now theoretically showcase an example in the regime where both and vanish. Again consider being Gaussian for simplicity.
The variance bound follows from the fact that for all .
Proofs
To prove Theorem 1, we decompose the mean square error into the bias and variance terms (Lemma 5.1), and provide data-dependent bound for each (Sections 5.2 and 5.3).
The following is a standard bias-variance decomposition for an estimator. We remark that it is an equality, and both terms have to be small to ensure the desired convergence.
The following decomposition for the interpolation estimator (2.2) holds
Recall the closed form solution of the interpolation estimator:
Define . Since , we have
2 Variance
In this section, we provide upper estimates on the variance part in (5.2).
Let . Under the assumptions (A.1)-(A.4), with probability at least with respect to a draw of ,
for and for large enough.
Let us discuss the first term in Eq. (5.4) and its role in implicit regularization induced by the curvature of the kernel, eigenvalue decay, and high dimensionality. In practice, the data matrix is typically centered, so . Therefore the first term is effectively
This formula explains the effect of implicit regularization, and captures the “effective rank” of the training data . We would like to emphasize that this measure of complexity is distinct from the classical notion of effective rank for regularized kernel regression (Caponnetto and De Vito, 2007), where the “effective rank” takes the form with , with is the eigenvalue of the population integral operator .
From the definition of and ,
Due to the fact that for , and , we have that and thus
Let us introduce two quantities for the ease of derivation. For defined in (3), let
and being the transpose of . By Proposition A.2, with probability at least , for the following holds
As a direct consequence, one can see that
provided is large enough, in the sense that
By Lemma B.2 (for Gaussian case, Lemma B.1),
where the the third inequality relies on (5.9) and (5.7), and the fourth inequality follows from (5.8).
We conclude that with probability at least ,
3 Bias
Let . The bias, under the only assumptions that for , and ’s are i.i.d. random vectors, is upper bounded as
In this proof, when there is no confusion, we use where denotes the coefficients of under the basis . Adopting this notation, we can write where also denotes a possibly infinite vector. For the bias, it is easier to work in the frequency domain using the spectral decomposition. Recalling the spectral characterization in the preliminary section,
Here we use the fact that and . Next, recall the empirical Kernel operator with its spectral decomposition , with . Denote the top columns of to be , and to be projection to the eigenspace orthogonal to . By observing that is a projection matrix, it is clear that for all ,
We continue the study of the last quantity using techniques inspired by Shawe-Taylor and Cristianini (2004). Denote the function indexed by any rank- projection as
Clearly, . Define the function class
It is clear that . Observe that is a random function that depends on the data , and we will bound the bias term using the empirical process theory. It is straightforward to verify that
Using symmetrization Lemma B.4 with , with probability at least ,
by the Pythagorean theorem. Since ’s are symmetric and zero-mean and does not depend on , the last expression is equal to
We further bound the Rademacher complexity of the set
by the Cauchy-Schwarz inequality and the fact that . The last expression is can be further evaluated by the independence of ’s
Therefore, for all , with probability at least ,
Let us compare the bounds obtained in this paper to those one can obtain for classification with a margin. For classification, Thm. 21 in Bartlett and Mendelson (2002) shows that the misclassification error is upper bounded with probability at least as
where is the margin loss surrogate for the indicator loss . By tuning the margin , one obtains a family of upper bounds.
Now consider the noiseless regression scenario (i.e. in (A.1)). In this case, the variance contribution to the risk is zero, and
where is the best-rank projection (based on ) and denotes its orthogonal projection. By tuning the parameter (similar as the in classification), one can balance the RHS to obtain the optimal trade-off.
However, classification is easier than regression in the following sense: can present a non-vanishing bias in estimating , but as long as the bias is below the empirical margin level, it plays no effect in the margin loss . In fact, for classification, under certain conditions, one can prove exponential convergence for the generalization error (Koltchinskii and Beznosova, 2005).
Experiments
In this section we provide full details of the experiments on MNIST (LeCun et al., 2010). Our first experiment considers the following problem: for each pair of distinct digits , , label one digit as and the other as , then fit the Kernel Ridge Regression with Gaussian kernel , where is the dimension as analyzed in our theory (also the default choice in Scikit-learn package (Pedregosa et al., 2011)). For each of the pairs of experiments, we chose (no regularization, interpolation estimator), and . We evaluated the performance on the out-of-sample test dataset, with the error metric
Remarkably, among all 45 experiments, no-regularization performs the best. We refer to the table in Section C for a complete list of numerical results. For each experiment, the sample size is roughly .
The second experiment is to perform the similar task on a finer grid of regularization parameter . Again, in all but one pair, the interpolation estimator performs the best in out-of-sample prediction. We refer to Figure 4 for details.
To conclude this experiment, we plot the eigenvalue decay of the empirical kernel matrix and the sample covariance matrix for the 5 experiments shown in the introduction. The two plots are shown in Figure 5. Both plots exhibit a fast decay of eigenvalues, supporting the theoretical finding that interpolation performs well on a test set in such situations.
On the other hand, it is easy to construct examples where the eigenvalues do not decay and interpolation performs poorly. This is the case, for instance, if are i.i.d. from spherical Gaussian. One can show that in the high-dimensional regime, the variance term itself (and not just the upper bound on it) is large. Since the bias-variance decomposition is an equality, it is not possible to establish good convergence.
2 A Synthetic Example
In this section we provide the details of the synthetic experiments mentioned in Section 4 for Tables 1-2 and Figures 2-3. We choose the RBF kernel as the non-linearity with . Again, we consider a family of eigenvalue decays for the covariance matrix parametrized by , with the small describing fast spectral decay
We set a target non-linear function in the RKHS with kernel as
For each parameter triplet , we generate data in the following way
for where is independent noise, with (Figures 2-3) and (Figures 8). Figures 6-7 contrasts the difference between the population and empirical eigenvalues for various parameter triplets .
We now explain Figures 2-3, which illustrate the true generalization error in this synthetic example, by varying the spectral decay , for a particular case of high dimensionality ratio . Here we plot the out-of-sample test error for the interpolated min-norm estimator on fresh new test data from the same data generating process, with the error metric
The error plots are shown in Figure 2 (for ) and 3 (for ), and Figure 8 for the high noise case. On the x-axis, we plot the , and on the y-axis the . Each curve corresponds to the generalization error behavior (and the bias and variance trade-off) as we vary spectral decay from fast to slow (as increases) for a particular choice of or ratio. Clearly, for a general pair of high dimensionality ratio , there is a “sweet spot” of (favorable geometric structure) such that the trade-off is optimized.
Further Discussion
This paper is motivated by the work of Belkin et al. (2018b) and Zhang et al. (2016), who, among others, observed the good out-of-sample performance of interpolating rules. This paper continues the line of work in (Belkin et al., 2018a, c; Belkin, 2018) on understanding theoretical mechanisms for the good out-of-sample performance of interpolation. We leave further investigations on the connection between kernel ridgeless regression and two-layer neural networks as a future work (Dou and Liang, 2019).
From an algorithmic point of view, the minimum-norm interpolating solution can be found either by inverting the kernel matrix, or by performing gradient descent on the least-squares objective (starting from ). Our analysis can then be viewed in the light of recent work on implicit regularization of optimization procedures (Yao et al., 2007; Neyshabur et al., 2014; Gunasekar et al., 2017; Li et al., 2017).
The paper also highlights a novel type of implicit regularization. In addition, we discover that once we parametrize the geometric properties — the spectral decay — we discover the familiar picture of the bias-variance trade-off, controlled by the implicit regularization that adapts to the favorable geometric property of the data. Moreover, if one explicitly parametrizes the choice of the kernel by, say, the bandwidth, we are likely to see the familiar picture of the bias-variance trade-off, despite the fact that the estimator is always interpolating. Whether one can achieve optimal rates of estimation (under appropriate assumptions) for the right choice of the bandwidth appears to be an interesting and difficult statistical question. Another open question is whether one can characterize situations when the interpolating minimum-norm solution is dominating the regularized solution in terms of expected performance.
References
Appendix A Propositions
We first borrow a technical result for concentration of quadratic forms under a mild moment condition.
The proof follows almost exactly as in Lemma A.3 (El Karoui, 2010). The only point of clarification is that one can assert
and thus for large enough, say , we have that . ∎
The following proposition is a non-asymptotic adaptation of Theorem 2.1 in (El Karoui, 2010). Our contribution here is only to carefully spell out the terms and emphasize that the error rate can be very slow (this is why (El Karoui, 2010) only provides a convergence in probability result).
Under the assumptions (A.1), (A.2), and (A.4), for , with probability at least ,
for large enough and small enough.
In (El Karoui, 2010), the approximation error can be decomposed into first-order term (diagonal approximation), second-order off-diagonal term , and third-order off-diagonal approximation ,
where , with probability at least . However, for only convergence in probability is obtained. On Page 19 in (El Karoui, 2010), the last line reads
Appendix B Lemmas and Corollaries
Under the assumptions (A.1), (A.4), and that i.i.d. Then with probability at least with respect to a draw of ,
Start with entry-wise Taylor expansion for the smooth kernel,
Conditionally on , with probability at least on drawn from ,
Using standard concentration bound, we know that with probability at least on
Therefore with probability at least on , conditionally on , we have
Define . The above says that, conditioned on , for all . Therefore, by defining change of variables ,
with probability at least on , for large enough. ∎
Under the assumptions (A.1), (A.2), and (A.4), for , we have with probability at least with respect to the draw of , for large enough,
We start with entry-wise Taylor expansion for the smooth kernel,
Conditionally on , by Bernstein’s inequality (Boucheron et al., 2013, p. 38), with probability at least on , for all
Here the second line uses the fact that due to the assumption (A.2) for each entry . Applying Proposition A.1 with the matrix taken to be identity, for all , with probability at least on
Therefore with probability at least with respect to , conditionally on
Define . The above says that, conditioned on , for all . Therefore, by change of variables , the expectation satisfies
with probability at least on , for large enough.
If , then . Since , it holds that
For the variance part, with , we have
where the last step uses (B.4). Therefore, using standard random matrix theory, one can further upper bound the above equation by
by the same argument as in the proof of Corollary 4.1. ∎
where denotes the conditional expectation with respect to i.i.d. Rademacher random variables .
The proof is a standard exercise using McDiarmid’s inequality and symmetrization. We include here for completeness. See (Mendelson, 2003, Theorem 2.21, 2.23 and their corollaries). ∎
Appendix C MNIST Result
Here the error is in percentage, so 2.921 corresponds to an error 2.921%.