Ridge Regression: Structure, Cross-Validation, and Sketching

Sifan Liu, Edgar Dobriban

Introduction

Here we seek to develop a deeper understanding of ridge regression, going beyond existing work in multiple aspects. We work in linear models under a popular asymptotic regime where n,p→∞n,p\to\infty at the same rate (Marchenko & Pastur, 1967; Serdobolskii, 2007; Couillet & Debbah, 2011; Yao et al., 2015). In this framework, we develop a fundamental representation for ridge regression, which shows that it is well approximated by a linear scaling of the true parameters perturbed by noise. The scaling matrices are functions of the population-level covariance of the features. As a consequence, we derive formulas for the training error and bias-variance tradeoff of ridge.

Second, we study commonly used methods for choosing the regularization parameter. Inspired by the observation that CV has a bias for estimating the error rate (e.g., Hastie et al., 2009, p. 243), we study the bias of CV for selecting the regularization parameter. We discover a surprisingly simple form for the bias, and propose a downward scaling bias correction procedure. Third, we study the accuracy loss of a class of randomized sketching algorithms for ridge regression. These algorithms approximate the sample covariance matrix by sketching or random projection. We show they can be surprisingly accurate, e.g., they can sometimes cut computational cost in half, only incurring 5% extra error. Even more, they can sometimes improve the MSE if a suboptimal regularization parameter is originally used.

Our work leverages recent results from asymptotic random matrix theory and free probability theory. One challenge in our analysis is to find the limit of the trace tr⁡(Σ1+Σ2−1)−1/p\operatorname{tr}{(\Sigma_{1}+\Sigma_{2}^{-1})^{-1}}/p, where Σ1\Sigma_{1} and Σ2\Sigma_{2} are p×pp\times p independent sample covariance matrices of Gaussian random vectors. The calculation requires nontrivial aspects of freely additive convolutions (e.g., Voiculescu et al., 1992; Nica & Speicher, 2006).

Our work is connected to prior works on ridge regression in high-dimensional statistics (Serdobolskii, 2007) and wireless communications (Tulino & Verdú, 2004; Couillet & Debbah, 2011). Among other related works, El Karoui & Kösters (2011) discuss the implications of the geometric sensitivity of random matrix theory for ridge regression, without considering our problems. El Karoui (2018) and Dicker (2016) study ridge regression estimators, but focus only on the risk for identity covariance. Hastie et al. (2019) study “ridgeless” regression, where the regularization parameter tends to zero.

Sketching is an increasingly popular research topic, see Vempala (2005); Halko et al. (2011); Mahoney (2011); Woodruff (2014); Drineas & Mahoney (2017) and references therein. For sketched ridge regression, Zhang et al. (2013a; b) study the dual problem in a complementary finite-sample setting, and their results are hard to compare. Chen et al. (2015) propose an algorithm combining sparse embedding and the subsampled randomized Hadamard transform (SRHT), proving relative approximation bounds. Wang et al. (2017) study iterative sketching algorithms from an optimization point of view, for both the primal and the dual problems. Dobriban & Liu (2018) study sketching using asymptotic random matrix theory, but only for unregularized linear regression. Chowdhury et al. (2018) propose a data-dependent algorithm in light of the ridge leverage scores. Other related works include Sarlos (2006); Ailon & Chazelle (2006); Drineas et al. (2006; 2011); Dhillon et al. (2013); Ma et al. (2015); Raskutti & Mahoney (2016); Gonen et al. (2016); Thanei et al. (2017); Ahfock et al. (2017); Lopes et al. (2018); Huang (2018).

The structure of the paper is as follows: We state our results on representation, risk, and bias-variance tradeoff in Section 2. We study the bias of cross-validation for choosing the regularization parameter in Section 3. We study the accuracy of randomized primal and dual sketching for both orthogonal and Gaussian sketches in Section 4. We provide proofs and additional simulations in the Appendix. Code reproducing the experiments in the paper are available at https://github.com/liusf15/RidgeRegression.

Ridge regression

where λ>0\lambda>0 is a regularization parameter. The solution has the closed form

We work in a ”big data” asymptotic limit, where both the dimension pp and the sample size nn tend to infinity, and their aspect ratio converges to a constant, p/n→γ∈(0,∞)p/n\rightarrow\gamma\in(0,\infty). Our results can be interpreted for any nn and pp, using γ=p/n\gamma=p/n as an approximation.

We recall that the empirical spectral distribution (ESD) of a p×pp\times p symmetric matrix Σ\Sigma is the distribution 1p∑i=1pδλi\frac{1}{p}\sum_{i=1}^{p}\delta_{\lambda_{i}} where λi,\lambda_{i}, i=1,…,pi=1,\ldots,p are the eigenvalues of Σ\Sigma, and δx\delta_{x} is the point mass at xx. This is a standard notion in random matrix theory, see e.g., Marchenko & Pastur (1967); Tulino & Verdú (2004); Couillet & Debbah (2011); Yao et al. (2015). The ESD is a convenient tool to summarize all information obtainable from the eigenvalues of a matrix. For instance, the trace of Σ\Sigma is proportional to the mean of the distribution, while the condition number is related to the range of the support. As is common, we will work in models where there is a sequence of covariance matrices Σ=Σp\Sigma=\Sigma_{p}, and their ESDs converges in distribution to a limiting probability distribution. The results become simpler, because they depend only on the limit.

By extension, we say that the ESD of the n×pn\times p matrix XX is the ESD of X⊤X/nX^{\top}X/n. We will consider some very specific models for the data, assuming it is of the form X=UΣ1/2X=U\Sigma^{1/2}, where UU has iid entries of zero mean and unit variance. This means that the datapoints, i.e., the rows of XX, have the form xi=Σ1/2uix_{i}=\Sigma^{1/2}u_{i}, i=1,…,pi=1,\ldots,p, where uiu_{i} have iid entries. Then Σ\Sigma is the ”true” covariance matrix of the features, which is typically not observed. These types of models for the data are very common in random matrix theory, see the references mentioned above.

Under these models, it is possible to characterize precisely the deviations between the empirical covariance matrix Σ^=n−1X⊤X\widehat{\Sigma}=n^{-1}X^{\top}X and the population covariance matrix Σ\Sigma, dating back to the well known classical Marchenko-Pastur law for eigenvectors (Marchenko & Pastur, 1967), extended to more general models and made more precise, including results for eigenvectors (see e.g., Tulino & Verdú, 2004; Couillet & Debbah, 2011; Yao et al., 2015, and references therein). This has been used to study methods for estimating the true covariance matrix, with several applications (e.g., Paul & Aue, 2014; Bun et al., 2017). More recently, such models have been used to study high dimensional statistical learning problems, including classification and regression (e.g., Zollanvari & Genton, 2013; Dobriban & Wager, 2018). Our work falls in this line.

We start by finding a precise representation of the ridge estimator. For random vectors un,vnu_{n},v_{n} of growing dimension, we say unu_{n} and vnv_{n} are deterministic equivalents, if for any sequence of fixed (or random and independent of un,vnu_{n},v_{n}) vectors wnw_{n} such that lim⁡sup⁡∥wn∥2<∞\lim\sup\|w_{n}\|_{2}<\infty almost surely, we have ∣wn⊤(un−vn)∣→0|w_{n}^{\top}(u_{n}-v_{n})|\to 0 almost surely. We denote this by un≍vnu_{n}\asymp v_{n}. Thus linear combinations of unu_{n} are well approximated by those of vnv_{n}. This is a somewhat non-standard definition, but it turns out that it is precisely the one we need to use prior results from random matrix theory such as from (Rubio & Mestre, 2011).

For a fixed design matrix XX, we can write the estimator as

However, for a random design, we can find a representation that depends on the true covariance Σ\Sigma, which may be simpler when Σ\Sigma is simple, e.g., when Σ=Ip\Sigma=I_{p} is isotropic.

Then the ridge regression estimator is asymptotically equivalent to a random vector with the following representation:

Here Z∼N(0,Ip)Z\sim\mathcal{N}(0,I_{p}) is a random vector that is stochastically dependent only on the noise ε\varepsilon, and A,BA,B are deterministic matrices defined by applying the scalar functions below to Σ\Sigma:

Here cp:=c(n,p,Σ,λ)c_{p}:=c(n,p,\Sigma,\lambda) is the unique positive solution of the fixed point equation

This result gives a precise representation of the ridge regression estimator. It is a sum of two terms: the true coefficient vector β\beta scaled by the matrix A(Σ,λ)A(\Sigma,\lambda), and the noise vector ZZ scaled by the matrix B(Σ,λ)B(\Sigma,\lambda). The first term captures to what extent ridge regression recovers the ”signal”. Morever, the noise term ZZ is directly coupled with the noise in the original regression problem, and thus also the estimator. The result would not hold for an independent noise vector ZZ.

However, the coefficients are not fully explicit, as they depend on the unknown population covariance matrix Σ\Sigma, as well as on the fixed-point variable cpc_{p}.

Structure of the proof. The proof is quite non-elementary and relies on random matrix theory. Specifically, it uses the language of the recently developed ”calculus of deterministic equivalents” (Dobriban & Sheng, 2018), and results by (Rubio & Mestre, 2011). A general takeaway is that for nn not much larger than pp, the empirical covariance matrix Σ^\widehat{\Sigma} is not a good estimator of the true covariance matrix Σ\Sigma. However, the deviation of linear functionals of Σ^\widehat{\Sigma}, can be quantified. In particular, we have

in the sense that linear combinations of the entries of the two matrices are close (see the proof for more details).

Understanding the resolvent bias factor cpc_{p}. Thus, cpc_{p} can be viewed as a resolvent bias factor, which tells us by what factor Σ\Sigma is multiplied when evaluating the resolvent (Σ^+λI)−1(\widehat{\Sigma}+\lambda I)^{-1}, and comparing it to its naive counterpart (Σ+λI)−1(\Sigma+\lambda I)^{-1}. It is known that cpc_{p} is well defined, and this follows by a simple monotonicity argument, see Hachem et al. (2007); Rubio & Mestre (2011). Specifically, the left hand side of (2) is decreasing in cpc_{p}, while the right hand size is increasing in

Also cp′c_{p}^{\prime} is the derivative of cpc_{p}, when viewing it as a function of z:=−λz:=-\lambda. An explicit expression is provided in the proof in Section A.1, but is not crucial right now.

Here we discuss some implications of this representation.

For uncorrelated features, Σ=Ip\Sigma=I_{p}, A,BA,B reduce to multiplication by scalars. Hence, each coordinate of the ridge regression estimator is simply a scalar multiple of the corresponding coordinate of β\beta. One can use this to find the bias in each individual coordinate.

For a distribution FF, we define the quantities

Bias-variance tradeoff. Building on this, we can also study the bias-variance tradeoff of ridge regression. Qualitatively, large λ\lambda leads to more regularization, and decreases the variance. However, it also increases the bias. Our theory allows us to find the explicit formulas for the bias and variance as a function of λ\lambda. See Figure 1 for a plot and Sec. A.3 for the details. As far as we know, this is one of the few examples of high-dimensional asymptotic problems where the precise form of the bias and variance can be evaluated.

Bias-variance tradeoff at optimal λ∗=γσ2/α2\lambda^{*}=\gamma\sigma^{2}/\alpha^{2}. (see Figure 6) This can be viewed as the ”pure” effect of dimensionality on the problem, keeping all other parameters fixed, and has intriguing properties. The variance first increases, then decreases with γ\gamma. In the ”classical” low-dimensional case, most of the risk is due to variance, while in the ”modern” high-dimensional case, most of it is due to bias. This is consistent with other phenomena in proportional-limit asymptotics, e.g., that the map between population and sample eigenvalue distributions is asymptotically deterministic (Marchenko & Pastur, 1967).

Future applications. This fundamental representation may have applications to important statistical inference questions. For instance, inference on the regression coefficient β\beta and the noise variance σ2\sigma^{2} are important and challenging problems. Can we use our representation to develop debiasing techniques for this task? This will be interesting to explore in future work.

Cross-validation

How can we choose the regularization parameter? In practice, cross-validation (CV) is the most popular approach. However, it is well known that CV has a bias for estimating the error rate, because it uses a smaller number of samples than the full data size (e.g., Hastie et al., 2009, p. 243). In this section, we study related questions, proposing a bias-correction method for the optimal regularization parameter. This is closely connected to the previous section, because it relies on the same random-effects theoretical framework. In fact, our conclusions here are a direct consequence of the properties of that framework.

Setup. Suppose we split the nn datapoints (samples) into KK equal-sized subsets, each containing n0=n/Kn_{0}=n/K samples. We use the kk-th subset (Xk,Yk)(X_{k},Y_{k}) as the validation set and the other K−1K-1 subsets (X−k,Y−k)\smash{(X_{-k},Y_{-k})}, with total sample size n1=(K−1)n/Kn_{1}=\smash{(K-1)n/K} as the training set. We find the ridge regression estimator β^−k\smash{\hat{\beta}_{-k}}, i.e.

The expected cross-validation error is, for isotropic covariance, i.e., Σ=I\Sigma=I,

Bias-correction. Suppose we have found λ^k∗\hat{\lambda}_{k}^{*}, the minimizer of CV^(λ)\widehat{CV}(\lambda). Afterwards, we usually refit ridge regression on the entire dataset, i.e., find

Based on our bias calculation, we propose to use a bias-corrected parameter

So if we use 5 folds, we should multiply the CV-optimal λ\lambda by 0.8. We find it surprising that this theoretically justified bias-correction does not depend on any unknown parameters, such as β,α2,σ2\beta,\alpha^{2},\sigma^{2}.While the bias of CV is widely known, we are not aware that this bias-correction for the regularization parameter has been proposed before.

Numerical examples. Figure 2 shows on two empirical data examples that the debiased estimator gets closer to the optimal λ\lambda than the original minimizer of the CV. However, in this case it does not significantly improve the test error. Simulation results in Section A.4 also show that the bias-correction correctly shrinks the regularization parameter and decreases the test error. We also consider examples where p≫np\gg n (i.e., γ≫1\gamma\gg 1), because this is a setting where it is known that the bias of CV can be large (Tibshirani & Tibshirani, 2009). However, in this case, we do not see a significant improvement.

Extensions. The same bias-correction idea also applies to train-test validation. In addition, there is a special fast “short-cut” for leave-one-out cross-validation in ridge regression (e.g., Hastie et al., 2009, p. 243), which has the same cost as one ridge regression. The minimizer converges to λ∗\lambda^{*} (Hastie et al., 2019). However, we think that the bias-correction idea is still valuable, as the idea applies beyond ridge regression: CV selects regularization parameters that are too large. See Section A.5 for more details and experiments comparing different ways of choosing the regularization parameter.

Sketching

A final important question about ridge regression is how to compute it in practice. In this section, we study that problem in the same high-dimensional model used throughout our paper. The computation complexity of ridge regression, O(npO(np min⁡(n,p))\min(n,p)), can be intractable in modern large-scale data analysis. Sketching is a popular approach to reducing the time complexity by reducing the sample size and/or dimension, usually by random projection or sampling (e.g. Mahoney, 2011; Woodruff, 2014; Drineas & Mahoney, 2016). Specifically, primal sketching approximates the sample covariance matrix X⊤X/nX^{\top}X/n by X⊤L⊤LX/nX^{\top}L^{\top}LX/n, where LL is an m×nm\times n sketching matrix, and m<nm<n. If LL is chosen as a suitable random matrix, then this can still approximate the original sample covariance matrix. Then the primal sketched ridge regression estimator is

The sketching matrices RR and LL are usually chosen as random matrices with iid entries (e.g., Gaussian ones) or as orthogonal matrices. In this section, we study the asymptotic MSE for both orthogonal (Section 4.1) and Gaussian sketching (Section 4.2). We also mention full sketching, which performs ridge after projecting down both XX and YY. In section A.11, we find its MSE. However, the other two methods have better tradeoffs, and we can empirically get better results for the same computational cost.

First we consider primal sketching with orthogonal projections. These can be implemented by subsampling, Haar distributed matrices, or subsampled randomized Hadamard transforms (Sarlos, 2006). We recall that the standard Marchenko-Pastur (MP) law is the probability distribution which is the limit of the ESD of X⊤X/nX^{\top}X/n, when the n×pn\times p matrix XX has iid standard Gaussian entries, and n,p→∞n,p\to\infty so that p/n→γ>0p/n\to\gamma>0, which has an explicit density (Marchenko & Pastur, 1967; Bai & Silverstein, 2010).

We compute primal sketched ridge regression (5) with an m×nm\times n orthogonal matrix LL (m<nm<n, LL⊤=ImLL^{\top}=I_{m}). Let n,pn,p and mm tend to infinity with p/n→γ∈(0,∞)p/n\rightarrow\gamma\in(0,\infty) and m/n→ξ∈(0,1)m/n\rightarrow\xi\in(0,1). Then the MSE of β^p(λ)\hat{\beta}_{p}(\lambda) has the limit

where θi(γ,λ)=∫(x+λ)−idFγ(x)\theta_{i}(\gamma,\lambda)=\int(x+\lambda)^{-i}dF_{\gamma}(x) and FγF_{\gamma} is the standard Marchenko-Pastur law with aspect ratio γ\gamma.

Structure of the proof. The proof is in Section A.6, with explicit formulas in Section A.6.1. The θi\theta_{i} are related to the resolvent of the MP law and its derivatives. In the proof, we decompose the MSE as the sum of variance and squared bias, both of which further reduce to the traces of certain random matrices, whose limits are determined by the MP law FγF_{\gamma} and λ\lambda. The two terms on the RHS of Equation (7) are the limits of squared bias and variance, respectively. There is an additional key step in the proof, which introduces the orthogonal complement L1L_{1} of the matrix LL such that L⊤L+L1⊤L1=InL^{\top}L+L_{1}^{\top}L_{1}=I_{n}, which leads to some Gaussian random variables appearing in the proof, and simplifies calculations.

Simulations. A simulation in Figure 3 (left) shows a good match with our theory. It also shows that sketching does not increase the MSE too much. In this case, by reducing the sample size to half the original one, we only increase the MSE by a factor of 1.05. This shows sketching can be very effective. We also see in Figure 3 (right) that variance is compromised much more than bias.

Robustness to tuning parameter. The reader may wonder how strongly this depends on the choice of the regularization parameter λ\lambda. Perhaps ridge regression works poorly with this λ\lambda, so sketching cannot worsen it too much? What happens if we take the optimal λ\lambda instead of a fixed one? In experiments in Section A.12 we show that the behavior is quite robust to the choice of regularization parameter.

The next theorem states a result for dual orthogonal sketching.

Under the conditions of Theorem 4.1, we compute the dual sketched ridge regression with an orthogonal p×dp\times d sketching matrix RR (d⩽pd\leqslant p, R⊤R=IdR^{\top}R=I_{d}). Let n,pn,p and dd go to infinity with p/n→γ∈(0,∞)p/n\rightarrow\gamma\in(0,\infty) and d/n→ζ∈(0,γ)d/n\rightarrow\zeta\in(0,\gamma). Then the MSE of β^d(λ)\hat{\beta}_{d}(\lambda) has the limit

where θˉi(ζ,λ)=(1−ζ)/λi+ζ∫(x+λ)−idFζ(x)\bar{\theta}_{i}(\zeta,\lambda)=(1-\zeta)/\lambda^{i}+\zeta\int(x+\lambda)^{-i}dF_{\zeta}(x), and FζF_{\zeta} is the standard Marchenko-Pastur law.

Proof structure and simulations. The proof in Section A.7 follows similar path to the previous one. Here θˉi\bar{\theta}_{i} comes in because of the companion Stieltjes transform of MP law. The simulation results shown in Figure 11 agrees well with our theory. They are similar to the ones before: sketching has favorable properties, and the bias increases less than the variance.

Optimal tuning parameters. For both primal and dual sketching, the optimal regularization parameter minimizing the MSE seems analytically intractable. Instead, we use a numerical approach in our experiments, based on a binary search. Since this is one-dimensional problem, there are no numerical issues. See Figure 13 in Section A.12.3.

It is of special interest to investigate extreme projections, where the sketching dimension is much reduced compared to the sample size, so m≪nm\ll n. This corresponds to ξ=0\xi=0. This can also be viewed as a scaled marginal regression estimator, i.e., β^∝X⊤Y\hat{\beta}\propto X^{\top}Y. For dual sketching, the same case can be recovered with ζ=0\zeta=0. Another interest of studying this special case is that the formula for MSE simplifies a lot.

Under the same assumption as Theorem 4.1, let ξ=0\xi=0. Then the form of the MSE is M(λ)=[α2[(λ−1)2+γ]+σ2γ]/λ2.M(\lambda)=[\alpha^{2}\left[(\lambda-1)^{2}+\gamma\right]+\sigma^{2}\gamma]/\lambda^{2}. Moreover, the optimal λ∗\lambda^{*} that minimizes this equals γσ2/α2+1+γ\gamma\sigma^{2}/\alpha^{2}+1+\gamma and the optimal MSE is M(λ∗)=α2(1−α2/[α2(1+γ)+γσ2]).M(\lambda^{*})=\alpha^{2}\left(1-\alpha^{2}/[\alpha^{2}(1+\gamma)+\gamma\sigma^{2}]\right).

The proof is in Section A.8. When is the optimal MSE of marginal regression small? Compared to the MSE of the zero estimator α2\alpha^{2}, it is small when γ(σ2/α2+1)+1\gamma(\sigma^{2}/\alpha^{2}+1)+1 is large. In Figure 4 (left), we compare marginal and ridge regression for different aspect ratios and SNR. When the signal to noise ratio (SNR) α2/σ2\alpha^{2}/\sigma^{2} is small or the aspect ratio γ\gamma is large, marginal regression does not increase the MSE much. As a concrete example, if we take α2=σ2=1\alpha^{2}=\sigma^{2}=1 and γ=0.7\gamma=0.7, the marginal MSE is 1−1/2.4≈0.581-1/2.4\approx 0.58. The optimal ridge MSE is about 0.520.52, so their ratio is only ca. 0.58/0.52≈1.10.58/0.52\approx 1.1. It seems quite surprising that a simple-minded method like marginal regression can work so well. However, the reason is that when the SNR is small, we cannot expect ridge regression to have good performance. Large γ\gamma can also be interpreted as small SNR, where ridge regression works poorly and sketching does not harm performance too much.

2 Gaussian sketching

In this section, we study Gaussian sketching. The following theorem states the bias of dual Gaussian sketching. The bias is enough to characterize the performance in the high SNR regime where α/σ→∞\alpha/\sigma\to\infty, and we discuss the extension to low SNR after the proof.

The function mm is characterized by its inverse function, which has the explicit formula m−1(z)=1/[1+z/ζ]−[γ+1−(γ−1)2+4λz]/(2z)m^{-1}(z)=1/[1+z/\zeta]-[\gamma+1-\sqrt{(\gamma-1)^{2}+4\lambda z}]/(2z) for complex zz with positive imaginary part.

About the proof. The proof is in Section A.9.We mention that the same result holds when the matrices involved have iid non-Gaussian entries, but the proof is more technical. The current proof is based on free probability theory (e.g., Voiculescu et al., 1992; Hiai & Petz, 2006; Couillet & Debbah, 2011). The function mm is the Stieltjes transform of the free additive convolution of a standard MP law F1/ξF_{1/\xi} and a scaled inverse MP law λ/γ⋅F1/γ−1\smash{\lambda/\gamma\cdot F_{1/\gamma}^{-1}} (see the proof).

Numerics. To evaluate the formula, we note that m−1(m(0))=0m^{-1}(m(0))=0, so m(0)m(0) is a root of m−1m^{-1}. Also, dm(0)/dzdm(0)/dz equals 1/(dm−1(y)/dy∣y=m(0))\smash{1/(dm^{-1}(y)/dy|_{y=m(0)})}, the reciprocal of the derivative of m−1m^{-1} evaluated at m(0)m(0). We use binary search to find the numerical solution. The theoretical result agrees with the simulation quite well, see Figure 4.

Somewhat unexpectedly, the MSE of dual sketching can be below the MSE of ridge regression, see Figure 4. This can happen when the original regularization parameter is suboptimal. As dd grows, the MSE of Gaussian dual sketching converges to that of ridge regression.

We have also found the bias of primal Gaussian sketching. However, stating the result requires free probability theory, and so we present it in the Appendix, see Theorem A.1. To further validate our results, we present additional simulations in Sec. A.12, for both fixed and optimal regularization parameters after sketching. A detailed study of the computational cost for sketching in Sec. A.13 concludes, as expected, that primal sketching can reduce cost when p<np<n, while dual sketching can reduce it when p>np>n; and also provides a more detailed analysis.

The authors thank Ken Clarkson for helpful discussions and for providing the reference Chen et al. (2015). ED was partially supported by NSF BIGDATA grant IIS 1837992. A version of our manuscript is available on arxiv at https://arxiv.org/abs/1910.02373.

References

Appendix A Appendix

If p/n→γp/n\to\gamma and the spectral distribution of Σ\Sigma converges to HH, we have by the general Marchenko-Pastur (MP) theorem of Rubio and Mestre (Rubio & Mestre, 2011), that

where cp:=c(n,p,Σ,λ)c_{p}:=c(n,p,\Sigma,\lambda) is the unique positive solution of the fixed point equation

Here, using the terminology of the calculus of deterministic equivalents (Dobriban & Sheng, 2018), two sequences of (not necessarily symmetric) n×nn\times n matrices An,BnA_{n},B_{n} of growing dimensions are equivalent, and we write

if lim⁡n→∞tr⁡[Cn(An−Bn)]=0\lim_{n\to\infty}\operatorname{tr}\left[C_{n}(A_{n}-B_{n})\right]=0 almost surely, for any sequence CnC_{n} of (not necessarily symmetric) n×nn\times n deterministic matrices with bounded trace norm, i.e., such that lim⁡sup⁡∥Cn∥tr<∞\lim\sup\|C_{n}\|_{tr}<\infty (Dobriban & Sheng, 2018). Informally, linear combinations of the entries of AnA_{n} can be approximated by the entries of BnB_{n}.

Then, by the general MP law written in the language of the calculus of deterministic equivalents

By the definition of equivalence for vectors,

We note a subtle point here. The rank of the matrix M:=(Σ^+λIp)−1Σ^M:=(\widehat{\Sigma}+\lambda I_{p})^{-1}\widehat{\Sigma} is at most nn, and so it is not a full rank matrix when n<pn<p. In contrast, cpΣ(cpΣ+λI)−1c_{p}\Sigma(c_{p}\Sigma+\lambda I)^{-1} can be a full rank matrix. Therefore, for the vectors β\beta in the null space of Σ^\widehat{\Sigma}, which is also the null space of XX, we certainly have that the two sides are not equal. However, here we assumed that the matrix XX is random, and so its null space is a random max⁡(p−n,0)\max(p-n,0) dimensional linear space. Therefore, for any fixed vector β\beta, the random matrix MM will not contain it in its null space with high probability, and so there is no contradiction.

We should also derive an asymptotic equivalent for

Suppose we have Gaussian noise, and let Z∼N(0,Ip)Z\sim\mathcal{N}(0,I_{p}). Then we can write

So the question reduces to finding a deterministic equivalent for h(Σ^)h(\widehat{\Sigma}), where h(x)=(x+λ)−2xh(x)=(x+\lambda)^{-2}x. Note that

By the calculus of determinstic equivalents: (Σ^+λ)−1≍(cpΣ+λI)−1(\widehat{\Sigma}+\lambda)^{-1}\asymp(c_{p}\Sigma+\lambda I)^{-1}. Moreover, fortunately the limit of the second part was recently calculated in (Dobriban & Sheng, 2019). This used the so-called ”differentiation rule” of the calculus of deterministic equivalents to find

The derivative cp′=dcp/dzc_{p}^{\prime}=dc_{p}/dz has been found in Dobriban & Sheng (2019), in the proof of Theorem 3.1, part 2b. The result is (with γp=p/n\gamma_{p}=p/n, HpH_{p} the spectral distribution of Σ\Sigma, and TT a random variable distributed according to HpH_{p})

A.2 Risk analysis

Figure 5 shows a simulation result. We see a good match between theory and simulation.

Denoting θi(γ,λ)=∫1(x+λ)idFγ(x)\theta_{i}(\gamma,\lambda)=\int\frac{1}{(x+\lambda)^{i}}dF_{\gamma}(x), then

For the standard Marchenko-Pastur law (i.e., when Σ=Ip\Sigma=I_{p}), we have the explicit forms of θ1\theta_{1} and θ2\theta_{2}. Specifically,

It is known that the limiting Stieltjes transform mFγ:=mγm_{F_{\gamma}}:=m_{\gamma} of Σ^\widehat{\Sigma} has the explicit form (Marchenko & Pastur, 1967):

As usual in the area, we use the principal branch of the square root of complex numbers. Hence θ1=(−λ+γ−1)+(−λ+γ−1)2+4λγ2λγ\theta_{1}=\frac{(-\lambda+\gamma-1)+\sqrt{(-\lambda+\gamma-1)^{2}+4\lambda\gamma}}{2\lambda\gamma}. Also

A.3 Bias-variance tradeoff

The limiting MSE decomposes into a limiting squared bias and variance. The specific forms of these are

See Figure 1 for a plot. We can make several observations.

The bias increases with λ\lambda, starting out at zero for λ=0\lambda=0 (linear regression), and increasing to α2\alpha^{2} as λ→∞\lambda\to\infty (zero estimator).

The variance decreases with λ\lambda, from γσ2∫x−1dFγ(x)\gamma\sigma^{2}\int x^{-1}dF_{\gamma}(x) to zero.

In the setting plotted in the figure, when α2\alpha^{2} and σ2\sigma^{2} are roughly comparable, there are additional qualitative properties we can investigate. When γ\gamma is small, the regularization parameter λ\lambda influences the bias more strongly than the variance (i.e., the derivative of the normalized quantities in the range plotted is generally larger for the normalized squared bias). In contrast when γ\gamma is large, the variance is influenced more.

Next we consider how bias and variance change with γ\gamma at the optimal λ∗=γσ2/α2\lambda^{*}=\gamma\sigma^{2}/\alpha^{2}. This can be viewed as the ”pure” effects of dimensionality on the problem, keeping all other parameters fixed. Ineed, α2/σ2\alpha^{2}/\sigma^{2} can be viewed as the signal-to-noise ratio (SNR), and is fixed. This analysis allows us to study for the best possible estimator (ridge regression, a Bayes estimator), behaves with the dimension. We refer to Figure 6, where we make some specific choices of α\alpha and σ\sigma.

Clearly the overall risk increases, as the problem becomes harder with increasing dimension. This is in line with our intuition.

The classical bias-variance tradeoff can be summarized by the equation

where we made explicit the dependence of the bias and variance on λ\lambda, and where M∗(α,γ)M^{*}(\alpha,\gamma) is the minimum MSE achievable, also known as the Bayes error, for which there are explicit formulas available (Tulino & Verdú, 2004; Dobriban & Wager, 2018).

The variance first increases, then decreases with γ\gamma. This shows that in the ”classical” low-dimensional case, most of the risk is due to variance, while in the ”modern” high-dimensional case, most of it is due to bias. This observation is consistent with other phenomena in proportional-limit asymptotics, for instance that the map between population and sample eigenvalue distributions is asymptotically deterministic (Marchenko & Pastur, 1967; Bai & Silverstein, 2010).

A.4 Simulations with cross-validation

See Figure 7. We consider both small and large γ\gamma. Our bias-correction procedure shrinks the λ\lambda to the correct direction and decreases the test error. It is also shown that the one-standard-error rule (e.g., Hastie et al., 2009) does not perform well here.

A.5 Choosing the regularization parameter- additional details

Another possible prediction method is to use the average of the ridge estimators computed during cross-validation. Here it is also natural to use the CV-optimal regularization parameters, averaging β^−k(λ^k∗)\hat{\beta}_{-k}(\hat{\lambda}_{k}^{*}), i.e.

This has the advantage that it does not require refitting the ridge regression estimator, and also that we use the optimal regularization parameter.

The same bias in the regularization parameter also applies to train-test validation. Since the number of samples is changed when restricting to the training set, the optimal λ\lambda chosen by train-test validation is also biased for the true regularization parameter minimizing the test error. We will later see in simulations (Figure 8) that retraining the ridge regression estimator on the whole data will still significantly improve the performance (this is expected based on our results on CV). For prediction, here we can also use ridge regression on the training set. This effectively reduces sample size n→ntrainn\to n_{train}, where ntrainn_{train} is the sample size of the training set. However, if the training set grows such that n/ntrain→1n/n_{train}\to 1 while ntrain→∞n_{train}\to\infty, the train-test split has asymptotically optimal performance.

A.5.2 Leave-one-out

There is a special “short-cut” for leave-one-out in ridge regression, which saves us from burdensome computation. Write loo(λ)loo(\lambda) for the leave-one-out estimator of prediction error with parameter λ\lambda. Instead of doing ridge regression nn times, we can calculate the error explicitly as

where S(λ)=X(X⊤X+nλI)−1X⊤S(\lambda)=X(X^{\top}X+n\lambda I)^{-1}X^{\top}. The minimizer of loo(λ)loo(\lambda) is asymptotically optimal, i.e., it converges to λ∗\lambda^{*} (Hastie et al., 2019). However, the computational cost of this shortcut is the same as that of a train-test split. Therefore, the method described above has the same asymptotic performance.

Simulations: Figure 8 shows simulation results comparing different cross-validation methods:

kf — k-fold cross-validation by taking the average of the ridge estimators at the CV-optimal regularization parameter.

kf refit — k-fold cross-validation by refitting ridge regression on the whole dataset using the CV-optimal regularization parameter.

kf bic — k-fold cross-validation by refitting ridge regression on the whole dataset using the CV-optimal regularization parameter, with bias correction.

tt — train-test validation, by using the ridge estimator computed on the train data, at the validation-optimal regularization parameter. Note: we expect this to be similar, but worse than the ”kf” estimator.

tt refit — train-test validation by refitting ridge regression on the whole dataset, using the validation-optimal regularization parameter. Note: we expect this to be similar, but slightly worse than the ”kf refit” estimator.

tt bic — train-test validation by refitting ridge regression on the whole dataset using the CV-optimal regularization parameter, with bias correction.

Figure 8 shows that the naive estimators (kf and tt) can be quite inaccurate without refitting or bias correction. However, if we either refit or bias-correct, the accuracy improves. In this case, there seems to be no significant difference between the various methods.

A.6 Proof of Theorem 4.1

Suppose m/n→ξm/n\rightarrow\xi as nn goes to infinity. For β^p\hat{\beta}_{p}, we have

Denote M=(X⊤L⊤LX/n+λIp)−1M=\left(X^{\top}L^{\top}LX/n+\lambda I_{p}\right)^{-1}, the resolvent of the sketched matrix. We further assume that XX has iid N(0,1)\mathcal{N}(0,1) entries and LL⊤=ImLL^{\top}=I_{m}. Let L1L_{1} be an orthogonal complementary matrix of LL, such that L⊤L+L1⊤L1=InL^{\top}L+L_{1}^{\top}L_{1}=I_{n}. We also denote N=X⊤L1⊤L1XnN=\frac{X^{\top}L_{1}^{\top}L_{1}X}{n}. Then

Therefore, using that Cov⁡[β]=α2/p⋅Ip\operatorname{Cov}\left[\beta\right]=\alpha^{2}/p\cdot I_{p}, we find the bias as

By the properties of Wishart matrices (e.g., Anderson, 2003; Muirhead, 2009), we have

Recalling that m,n→∞m,n\to\infty such that m/n→ξm/n\to\xi, and that θi(γ,λ)=∫(x+λ)−idFγ(x)\theta_{i}(\gamma,\lambda)=\int(x+\lambda)^{-i}dF_{\gamma}(x),

Note that these can be connected to the previous definitions by

Therefore the AMSE of β^p\hat{\beta}_{p} is

Consider the special case where Γ=I\Gamma=I, that is, XX has iid N(0,1)\mathcal{N}(0,1) entries. Then FγF_{\gamma} is the standard MP law, and we have the explicit forms for θi=θi(γ,λ)=∫1(x+λ)idFγ\theta_{i}=\theta_{i}(\gamma,\lambda)=\int\frac{1}{(x+\lambda)^{i}}dF_{\gamma}:

The results are obtained by the contour integral formula

See Proposition 2.10 of Yao et al. (2015).

A.7 Proof of Theorem 4.2

Suppose d/p→ζd/p\rightarrow\zeta as nn goes to infinity. For β^d\hat{\beta}_{d}, we have

Denote M=(XRR⊤X⊤/n+λIn)−1M=\left(XRR^{\top}X^{\top}/n+\lambda I_{n}\right)^{-1}. Note that, using that Cov⁡[β]=α2/p⋅Ip\operatorname{Cov}\left[\beta\right]=\alpha^{2}/p\cdot I_{p}

Moreover, letting R1R_{1} to be an orthogonal complementary matrix of RR, such that RR⊤+R1R1⊤=InRR^{\top}+R_{1}R_{1}^{\top}=I_{n}, and N=XR1R1⊤X⊤nN=\frac{XR_{1}R_{1}^{\top}X^{\top}}{n},

Thus we find the following exprssion for the limiting squared bias:

With similar calculations (that we omit for brevity), we can find

Therefore the AMSE of β^d\hat{\beta}_{d} is

A.8 Proof of Theorem 4.3

Recall that we have m,n→∞m,n\to\infty, such that m/n→ξm/n\to\xi. Then we need to take ξ→0\xi\to 0. However, we find it more convenient to do the calculation directly from the finite sample results as m,n,p→∞m,n,p\to\infty with m/n→0m/n\to 0, p/n→γp/n\to\gamma, It is not hard to check that computing the results in the other way (i.e., interchanging the limits), leads to the same results. Starting from our bias formula for primal sketching, we first get

The limit of the trace term is not entirely trivial, but it can be calculated by (1) observing that the m×pm\times p sketched data matrix P=LXP=LX has iid normal entries (2) thus the operator norm of P⊤P/nP^{\top}P/n vanishes, (3) and so by a simple matrix perturbation argument the trace concentrates around p/λ2p/\lambda^{2}. This gives the rough steps of finding the above limit. Moreover,

So the MSE is M(λ)=α2[(λ−1)2+γ]/λ2+σ2⋅γ/λ2M(\lambda)=\alpha^{2}[(\lambda-1)^{2}+\gamma]/\lambda^{2}+\sigma^{2}\cdot\gamma/\lambda^{2}. From this it is elementary to find the optimal λ\lambda and its objective value. ∎

A.9 Proof of Theorem 4.4

Write G=XX⊤G=XX^{\top}. Since RR⊤∼Wp(Ip,d)RR^{\top}\sim\mathcal{W}_{p}(I_{p},d), we have XRR⊤X⊤∼Wn(G,d)XRR^{\top}X^{\top}\sim\mathcal{W}_{n}(G,d). So XRR⊤X⊤=dG1/2WG1/2XRR^{\top}X^{\top}\stackrel{{\scriptstyle d}}{{=}}G^{1/2}WG^{1/2}, where W∼Wn(In,d)W\sim\mathcal{W}_{n}(I_{n},d).

So we need to find the law of Wd+λγ(Gp)−1\frac{W}{d}+\frac{\lambda}{\gamma}(\frac{G}{p})^{-1}. Suppose first that G=XX⊤∼Wn(In,p)G=XX^{\top}\sim\mathcal{W}_{n}(I_{n},p). Then WW and G−1G^{-1} are asymptotically freely independent. The l.s.d. of W/dW/d is the MP law F1/ξF_{1/\xi} while the l.s.d. of G/pG/p is the MP law F1/γF_{1/\gamma}. We need to find the additive free convolution W⊞GˉW\boxplus\bar{G}, where Gˉ=λγG−1\bar{G}=\frac{\lambda}{\gamma}G^{-1}.

Recall that the RR-transform of a distribution FF is defined by

where mF−1(z)m_{F}^{-1}(z) is the inverse function of the Stieltjes transform of FF (e.g., Voiculescu et al., 1992; Hiai & Petz, 2006; Couillet & Debbah, 2011). We can find the RR-transform by solving

Since we have the property that Raμ(z)=aRμ(az)R_{a\mu}(z)=aR_{\mu}(az),

Moreover, the Stieltjes transform of μ=W⊞Gˉ\mu=W\boxplus\bar{G} satisfies

So it suffices to find m(z)m(z) and ddzm(z)\frac{d}{dz}m(z) evaluated at zero. ∎

This result can characterize the performance of sketching in the high SNR regime, where α≫σ\alpha\gg\sigma. To understand the lower SNR regime, we need to study the variance, and thus we need to calculate

where G=XX⊤∼Wn(In,p)G=XX^{\top}\sim\mathcal{W}_{n}(I_{n},p) is a Wishart distribution, and XRR⊤X⊤=dG1/2WG1/2XRR^{\top}X^{\top}=_{d}G^{1/2}WG^{1/2}, with W∼Wn(In,r)W\sim\mathcal{W}_{n}(I_{n},r). This seems to be quite challenging, and we leave it to future work.

A.10 Results for primal Gaussian sketching

The statement requires some notions from free probability, see e.g., Voiculescu et al. (1992); Hiai & Petz (2006); Nica & Speicher (2006); Anderson et al. (2010); Couillet & Debbah (2011) for references .

and (X⊤L⊤LX/(nd)+λIp)−1X⊤=X⊤(L⊤LXX⊤/(nd)+λIn)−1\left(X^{\top}L^{\top}LX/(nd)+\lambda I_{p}\right)^{-1}X^{\top}=X^{\top}(L^{\top}LXX^{\top}/(nd)+\lambda I_{n})^{-1}. Thus

First we find the l.s.d. of (L⊤LXX⊤nd+λIn)−1XX⊤n(\frac{L^{\top}LXX^{\top}}{nd}+\lambda I_{n})^{-1}\frac{XX^{\top}}{n}. Write W=L⊤LW=L^{\top}L, G=XX⊤G=XX^{\top}. Then

which is similar to (Wd+λ(Gn)−1)−1(\frac{W}{d}+\lambda(\frac{G}{n})^{-1})^{-1}. So it suffices to find the l.s.d. of (Wd+λγ(Gp)−1)−1(\frac{W}{d}+\frac{\lambda}{\gamma}(\frac{G}{p})^{-1})^{-1}.

By the definition, W∼Wn(In,d)W\sim\mathcal{W}_{n}(I_{n},d), G∼Wn(In,p)G\sim\mathcal{W}_{n}(I_{n},p), therefore the l.s.d. of W/dW/d converges to the MP law F1/ξF_{1/\xi} and the l.s.d. of G/pG/p converges to the MP law F1/γF_{1/\gamma}.

We write A=WdA=\frac{W}{d}, B=λγ(Gp)−1B=\frac{\lambda}{\gamma}(\frac{G}{p})^{-1}. Then it suffices to find

We will find an expression for this using free probability. For this we will need to use some series expansions. There are two cases, depending on whether the operator norm of BA−1BA^{-1} is less than or greater than unity, leading to different series expansions. We will work out below the first case, but the second case is similar and leads to the same answer.

Since the operator norm of BA−1BA^{-1} is less unity, we have the von Neumann series expansion

Since AA and BB are asymptotically freely independent in the free probability space arising in the limit (e.g., Voiculescu et al., 1992; Hiai & Petz, 2006; Couillet & Debbah, 2011), and the polynomial (a−1b)i+j+1a−1b−1(a^{-1}b)^{i+j+1}a^{-1}b^{-1} involves an alternating sequence of a,ba,b, we have

A.11 Results for full sketching

The full sketch estimator projects down the entire data, and then does ridge regression on the sketched data. It has the form

The optimal λ\lambda for full sketch is always λ∗=γσ2α2\lambda^{*}=\frac{\gamma\sigma^{2}}{\alpha^{2}}, the same as ridge regression. Some simulation results are shown in Figure 10, and they show the expected shape (e.g., they decrease with ξ\xi).

A.12 Numerical results

See Figure 11 for additional simulation results for dual orthogonal sketching.

A.12.2 Performance at a fixed regularization parameter

First we fix the regularization parameter at the optimal value for original ridge regression. The results are visualized in Figure 12. On the xx axis, we plot the reduction in sample size m/nm/n for primal sketch, and the reduction in dimension d/pd/p for dual sketch. In this case, primal and dual sketch will increase both bias and variance, and empirically in the current case, dual sketch increases them more. So in this particular case, primal sketch is preferred.

A.12.3 Performance at the optimal regularization parameter

We find the optimal regularization parameter λ\lambda for primal and dual orthogonal sketching.

Then we use the optimal regularization parameter for all settings, see Figure 13. Both primal and dual sketch increase the bias, but decrease the variance. It is interesting to note that, for equal parameters ξ\xi and ζ\zeta, and in our particular case, dual sketch has smaller variance, but larger bias. So primal sketch is preferred bias or MSE is important, but dual sketch is more desired when one wants smaller variance. All in all, dual sketch has larger MSE than primal sketch in the current setting. It can also be seen that in this specific example, the optimal λ\lambda for primal sketch is smaller than that of dual sketch. However these results are hard to interpret, because there is no natural correspondence between the two parameters ξ\xi and ζ\zeta.

A.13 Computational complexity

Since sketching is a method to reduce computational complexity, it is important to discuss how much computational efficiency we gain. Recall our three estimators

Their computational complexity, when computed in the usual way, is:

No sketch (Standard ridge): if p<np<n, computing X⊤YX^{\top}Y and X⊤XX^{\top}X requires O(np)O(np) and O(np2)O(np^{2}) flops, then solving the linear equation (X⊤X/n+λIp)β^=X⊤Y/n(X^{\top}X/n+\lambda I_{p})\hat{\beta}=X^{\top}Y/n requires O(p3)O(p^{3}) flops by the LU decomposition. It is O(np2)O(np^{2}) flops in total.

If p>np>n, we use the second formula for β^\hat{\beta}, and the total flops is O(pn2)O(pn^{2}).

Primal sketch: for the Hadamard sketch (and other sketches based on the FFT), computing LXLX by FFT requires mplog⁡nmp\log n, computing (LX)⊤LX(LX)^{\top}LX requires mp2mp^{2}, so the total flops is O(p3+mp(log⁡n+p))O(p^{3}+mp(\log n+p)). So the primal sketch can reduce the computation cost only when p<np<n.

Dual sketch: computing XRR⊤X⊤XRR^{\top}X^{\top} requires ndnd (log⁡p+n)(\log p+n) flops by FFT, solving (XRR⊤X⊤/n+λIn)−1(XRR^{\top}X^{\top}/n+\lambda I_{n})^{-1} YY requires O(n3)O(n^{3}) flops, the matrix-vector multiplication of X⊤X^{\top} and (XRR⊤X⊤/n+λIn)−1Y(XRR^{\top}X^{\top}/n+\lambda I_{n})^{-1}Y requires O(np)O(np) flops, so the total flops is O(n3+nd(log⁡p+n))O(n^{3}+nd(\log p+n)). Dual sketching can reduce the computation cost only when p>np>n.