Sketching as a Tool for Numerical Linear Algebra

David P. Woodruff

Introduction

To give the reader a flavor of results in this survey, let us first consider the classical linear regression problem. In a special case of this problem one attempts to “fit” a line through a set of given points as best as possible.

For example, the familiar Ohm’s law states that the voltage VV is equal to the resistance RR times the electrical current II, or V=R⋅IV=R\cdot I. Suppose one is given a set of nn example volate-current pairs (vj,ij)(v_{j},i_{j}) but does not know the underlying resistance. In this case one is attempting to find the unknown slope of a line through the origin which best fits these examples, where best fits can take on a variety of different meanings.

More formally, in the standard setting there is one measured variable bb, in the above example this would be the voltage, and a set of dd predictor variables a1,…,ada_{1},\ldots,a_{d}. In the above example d=1d=1 and the single predictor variable is the electrical current. Further, it is assumed that the variables are linearly related up to a noise variable, that is b=x0+a1x1+⋯+adxd+γb=x_{0}+a_{1}x_{1}+\cdots+a_{d}x_{d}+\gamma, where x0,x1,…,xdx_{0},x_{1},\ldots,x_{d} are the coefficients of a hyperplane we are trying to learn (which does not go through the origin if x0≠0x_{0}\neq 0), and γ\gamma is a random variable which may be adversarially chosen, or may come from a distribution which we may have limited or no information about. The xix_{i} are also known as the model parameters. By introducing an additional predictor variable a0a_{0} which is fixed to 11, we can in fact assume that the unknown hyperplane goes through the origin, that is, it is an unknown subspace of codimension 11. We will thus assume that b=a1x1+⋯+adxd+γb=a_{1}x_{1}+\cdots+a_{d}x_{d}+\gamma and ignore the affine component throughout.

Subspace Embeddings and Least Squares Regression

We are interested in fast solutions to this problem, which we present in §2.5.

Definition 2 will be used in applications throughout this book, and sometimes for convenience we will drop the word oblivious.

Returning to Definition 2, the first usage of this in the numerical linear algebra community, to the best of our knowledge, was done by Sárlos, who proposed using Fast Johnson Lindenstrauss transforms to provide subspace embeddings. We follow the exposition in Sarlós for this .

which implies all inner products are preserved up to ε\varepsilon by rescaling ε\varepsilon by a constant.

There are many constructions of Johnson-Lindenstrauss transforms, possibly the simplest is given by the following theorem.

We will see a proof of Theorem 4 in Lemma 18.

By an argument of , it suffices to choose N\mathcal{N} so that for all y∈S{\mathbf{y}}\in\mathcal{S}, there exists a vector w∈N{\mathbf{w}}\in\mathcal{N} for which ∥y−w∥2≤1/2\|{\mathbf{y}}-{\mathbf{w}}\|_{2}\leq 1/2. We will refer to N\mathcal{N} as a (1/2)(1/2)-net for S\mathcal{S}.

To see that N\mathcal{N} suffices, if y{\mathbf{y}} is a unit vector, then we can write

where ∥yi∥≤12i\|{\mathbf{y}}^{i}\|\leq{1\over 2^{i}} and yi{\mathbf{y}}^{i} is a scalar multiple of a vector in N\mathcal{N}. This is because we can write y=y0+(y−y0){\mathbf{y}}={\mathbf{y}}^{0}+({\mathbf{y}}-{\mathbf{y}}^{0}) where y0∈N{\mathbf{y}}^{0}\in\mathcal{N} and ∥y−y0∥≤1/2\|{\mathbf{y}}-{\mathbf{y}}^{0}\|\leq 1/2 by the definition of N\mathcal{N}. Then, y−y0=y1+((y−y0)−y1){\mathbf{y}}-{\mathbf{y}}^{0}={\mathbf{y}}^{1}+(({\mathbf{y}}-{\mathbf{y}}^{0})-{\mathbf{y}}^{1}) where y1∈N{\mathbf{y}}^{1}\in\mathcal{N} and

The expansion in (3) then follows by induction. But then,

where the first equality follows by (3), the second equality follows by expanding the square, the third equality follows from (2), and the fourth equality is what we want (after rescaling ε\varepsilon by a constant factor).

We show the existence of a small (1/2)(1/2)-net N\mathcal{N} via a standard argument.

For any 0<γ<10<\gamma<1, there exists a γ\gamma-net N\mathcal{N} of S\mathcal{S} for which ∣N∣≤(1+4/γ)d|\mathcal{N}|\leq(1+4/\gamma)^{d}.

This can be done by choosing a maximal set N′\mathcal{N}^{\prime} of points on St−1\mathcal{S}^{t-1} so that no two points are within distance γ/2\gamma/2 from each other. It follows that the balls of radius γ/4\gamma/4 centered at these points are disjoint, but on the other hand they are all contained in the ball of radius 1+γ/41+\gamma/4 centered at the origin. The volume of the latter ball is a factor (1+γ/4)t/(γ/4)t(1+\gamma/4)^{t}/(\gamma/4)^{t} larger than the smaller balls, which implies ∣N′∣≤(1+4/γ)t|\mathcal{N}^{\prime}|\leq(1+4/\gamma)^{t}. See, e.g., for more details.

It follows by setting V=NV=\mathcal{N} and f=9df=9^{d} in Theorem 4, we can then apply Lemma 5 and (2) to obtain the following theorem. Note that the net size does not depend on ε\varepsilon, since we just need a 1/21/2-net for the argument, even though the theorem holds for general ε\varepsilon.

The Fast Johnson Lindenstrauss Transform is significantly faster than the above O(nnz(x)⋅ε−1log⁡(f/δ))O({\rm nnz}({\mathbf{x}})\cdot\varepsilon^{-1}\log(f/\delta)) time for many reasonable settings of the parameters, e.g., in a number of numerical linear algebra applications in which 1/δ1/\delta can be exponentially large in dd. Indeed, the Fast Johnson Lindenstrauss Transform was first used by Sárlos to obtain the first speedups for regression and low rank matrix approximation with relative error. Sárlos used a version of the Fast Johnson Lindenstrauss Transform due to . We will use a slightly different version called the Subsampled Randomized Hadamard Transform, or SRHT for short. Later we will see a significantly faster transform for sparse matrices.

We will not present the proof of Theorem 7, instead relying upon the above intuition. The proof of Theorem 7 can be found in the references listed above.

There are distributions on matrices SS with the following properties:

2 Matrix multiplication

In this section we study the approximate matrix product problem.

Before giving the theorem, we need a definition.

We now show that sparse embeddings matrices satisfy the (ε,δ,2)(\varepsilon,\delta,2)-JL-moment property. This was originally shown by Thorup and Zhang .

where the second equality uses that hh and σ\sigma are independent, while the third equality uses that E[σ(j)σ(j′)]=1{\bf E}[\sigma(j)\sigma(j^{\prime})]=1 if j=j′j=j^{\prime}, and otherwise is equal to .

where the second equality uses the independence of hh and σ\sigma, and the third equality uses that since σ\sigma is 44-wise independent, in order for E[σ(j1)σ(j2)σ(j1′)σ(j2′)]{\bf E}\left[\sigma(j_{1})\sigma(j_{2})\sigma(j_{1}^{\prime})\sigma(j_{2}^{\prime})\right] not to vanish, it must be that either

j1=j2=j1′=j2′j_{1}=j_{2}=j_{1}^{\prime}=j_{2}^{\prime} or

j1=j2j_{1}=j_{2} and j1′=j2′j_{1}^{\prime}=j_{2}^{\prime} but j1≠j1′j_{1}\neq j_{1}^{\prime} or

j1=j1′j_{1}=j_{1}^{\prime} and j2=j2′j_{2}=j_{2}^{\prime} but j1≠j2j_{1}\neq j_{2} or

j1=j2′j_{1}=j_{2}^{\prime} and j1′=j2j_{1}^{\prime}=j_{2} but j1≠j2j_{1}\neq j_{2}.

Note that in the last two cases, for E[δ(h(j1)=i)δ(h(j2)=i)δ(h(j1′)=i′)δ(h(j2′)=i′)]{\bf E}\left[\delta(h(j_{1})=i)\delta(h(j_{2})=i)\delta(h(j^{\prime}_{1})=i^{\prime})\delta(h(j^{\prime}_{2})=i^{\prime})\right] not to vanish, we must have i=i′i=i^{\prime}. The fourth equality and first inequality are based on regrouping the summations, and the sixth inequality uses that ∥x∥2=1\|{\mathbf{x}}\|_{2}=1.

3 High probability

() Algorithm 1 outputs a subspace embedding with probability at least 1−δ1-\delta. In expectation step 3 is only run a constant number of times.

4 Leverage scores

Proof: We will use the following matrix Chernoff bound for a sum of random matrices, which is a non-commutative Bernstein bound.

For any jj, zjTzj/qj{\mathbf{z}}_{j}^{T}{\mathbf{z}}_{j}/q_{j} is a rank-11 matrix with operator norm bounded by ∥zj∥22/qj≤k/β\|{\mathbf{z}}_{j}\|_{2}^{2}/q_{j}\leq k/\beta. Hence,

We need a version of the Johnson-Lindenstrauss lemma, as follows. We give a simple proof for completeness.

The random variable ∑i=1tgi2\sum_{i=1}^{t}g_{i}^{2} is χ2\chi^{2} with tt degree of freedom. The following tail bounds are known.

(Lemma 1 of ) Let g1,…,gtg_{1},\ldots,g_{t} be i.i.d. N(0,1)N(0,1) random variables. Then for any x≥0x\geq 0,

Setting x=ε2t/16x=\varepsilon^{2}t/16, we have that

For t=O(log⁡n/ε2)t=O(\log n/\varepsilon^{2}), the lemma follows by a union bound over i∈[n]i\in[n].

Finally, it follows that for all i∈[n]i\in[n],

Hence, qi≥(1−γ)(1−2γ)piq_{i}\geq(1-\gamma)(1-2\gamma)p_{i}, which for an appropriate choice of constant γ∈(0,1)\gamma\in(0,1), achieves qi≥βpiq_{i}\geq\beta p_{i}, as desired.

5 Regression

We formally define the regression problem as follows.

Inspecting the simple proof of Theorem 21 we see that (10) in particular implies

Because of the normal equations, we may apply the Pythagorean theorem,

where the first inequality is the triangle inequality, the second inequality uses the sub-multiplicativity of the spectral norm, and the third inequality uses (12). Rearranging, we have

By the normal equations in the sketch space,

6 Machine precision regression

Here we show how to reduce the dependence on ε\varepsilon to logarithmic in the regression application, following the approaches in .

and by choosing ε0=1/2\varepsilon_{0}=1/2, say, O(log⁡(1/ε))O(\log(1/\varepsilon)) iterations suffice for this scheme also to attain ε\varepsilon relative error.

7 Polynomial fitting

We now describe the problem more precisely, starting with a definition.

Vandermonde matrices of dimension n×qn\times q require only O(n)O(n) implicit storage and admit O(n log⁡2q)O(n~{}\log^{2}q) matrix-vector multiplication time (see, e.g., Theorem 2.11 of ). It is also possible to consider block-Vandermonde matrices as in ; for simplicity we will only focus on the simplest polynomial fitting problem here, in which Vandermonde matrices suffice for the discussion.

Least Absolute Deviation Regression

While least squares regression is arguably the most used form of regression in practice, it has certain non-robustness properties that make it unsuitable for some applications. For example, oftentimes the noise in a regression problem is drawn from a normal distribution, in which case least squares regression would work quite well, but if there is noise due to measurement error or a different underlying noise distribution, the least squares regression solution may overfit this noise since the cost function squares each of its summands.

where the inequality follows by Hölder’s inequality.

where ζ∈(0,1]\zeta\in(0,1] can be thought of as a relaxation parameter which will allow for more efficient algorithms.

Using this bound together with independence of the sampled rows,

We have computed E[Z]{\bf E}[Z] and bounded Var[Z]{\bf Var}[Z] as well as max⁡i∣pi<1Zi\max_{i\mid p_{i}<1}Z_{i}, and can now use strong tail bounds to bound the deviation of ZZ from its expectation. We use the following tail inequalities.

Moreover, if Zi−E[Zi]≤ΔZ_{i}-{\bf E}[Z_{i}]\leq\Delta for all ii, we have

It suffices to choose N\mathcal{N} so that for all y∈B{\mathbf{y}}\in\mathcal{B}, there exists a vector w∈N{\mathbf{w}}\in\mathcal{N} for which ∥y−w∥1≤ε\|{\mathbf{y}}-{\mathbf{w}}\|_{1}\leq\varepsilon. Indeed, in this case note that

If y−w=0{\mathbf{y}}-{\mathbf{w}}=0, we are done. Otherwise, suppose α\alpha is such that α∥y−w∥1=1\alpha\|{\mathbf{y}}-{\mathbf{w}}\|_{1}=1. Observe that α≥1/ε\alpha\geq 1/\varepsilon, since, ∥y−w∥1≤ε\|{\mathbf{y}}-{\mathbf{w}}\|_{1}\leq\varepsilon yet α∥y−w∥1=1\alpha\|{\mathbf{y}}-{\mathbf{w}}\|_{1}=1.

Then α(y−w)∈B\alpha({\mathbf{y}}-{\mathbf{w}})\in\mathcal{B}, and we can choose a vector w2∈N{\mathbf{w}}^{2}\in\mathcal{N} for which ∥α(y−w)−w2∥1≤ε\|\alpha({\mathbf{y}}-{\mathbf{w}})-{\mathbf{w}}^{2}\|_{1}\leq\varepsilon, or equivalently, ∥y−w−w2/α∥1≤ε/α≤ε2\|{\mathbf{y}}-{\mathbf{w}}-{\mathbf{w}}^{2}/\alpha\|_{1}\leq\varepsilon/\alpha\leq\varepsilon^{2}. Hence,

Repeating this argument, we inductively have that

There exists an ε\varepsilon-net N\mathcal{N} for which ∣N∣≤(2/ε)d|\mathcal{N}|\leq(2/\varepsilon)^{d}.

Then B(ε,0)B(\varepsilon,0) is a dd-dimensional polytope with a (dd-dimensional) volume denoted ∣B(ε,0)∣|B(\varepsilon,0)|. Moreover, B(1,0)B(1,0) and B(ε/2,0)B(\varepsilon/2,0) are similar polytopes, namely, B(1,0)=(2/ε)B(ε/2,0)B(1,0)=(2/\varepsilon)B(\varepsilon/2,0). As such, ∣B(1,0)∣=(2/ε)d∣B(ε/2,0)∣|B(1,0)|=(2/\varepsilon)^{d}|B(\varepsilon/2,0)|.

By applying (19) and a union bound over the points in N\mathcal{N}, and rescaling ε\varepsilon by a constant factor, we have thus shown the following theorem.

2 The Role of subspace embeddings for L1-Regression

Before discussing the existence of such embeddings, let us see how they can be used to speed up the computation of a well-conditioned basis.

3 Gaussian sketching to speed up sampling

we have that (20) holds with ζ=1/(4d)\zeta=1/(4d).

4 Subspace embeddings using cauchy random variables

The Cauchy distribution, having density function p(x)=1π⋅11+x2p(x)={1\over\pi}\cdot{1\over 1+x^{2}}, is the unique 11-stable distribution. That is to say, if C1,…,CMC_{1},\ldots,C_{M} are independent Cauchys, then ∑i∈[M]γiCi\sum_{i\in[M]}\gamma_{i}C_{i} is distributed as a Cauchy scaled by γ=∑i∈[M]∣γi∣\gamma=\sum_{i\in[M]}|\gamma_{i}|.

The absolute value of a Cauchy distribution has density function f(x)=2p(x)=2π11+x2f(x)=2p(x)={2\over\pi}{1\over 1+x^{2}}. The cumulative distribution function F(z)F(z) of it is

Note also that since tan⁡(π/4)=1\tan(\pi/4)=1, we have F(1)=1/2F(1)=1/2, so that 11 is the median of this distribution.

Although Cauchy random variables do not have an expectation, and have infinite variance, some control over them can be obtained by clipping them. The first use of such a truncation technique in algorithmic applications that we are aware of is due to Indyk .

Consider the event E\mathcal{E} that a Cauchy random variable XX satisfies ∣X∣≤M|X|\leq M, for some parameter M≥2M\geq 2. Then there is a constant c>0c>0 for which Pr⁡[E]≥1−2πM\Pr[\mathcal{E}]\geq 1-{2\over\pi M} and E[∣X∣∣E]≤clog⁡M,{\bf E}[|X|\mid\mathcal{E}]\leq c\log M, where c>0c>0 is an absolute constant.

(see “Connection to Auerbach bases” in Section 3.1 of ) There exists a (d,1,1)(d,1,1)-well-conditioned basis.

For readability, it is useful to separate out the following key lemma that is used in Theorem 36 below. This analysis largely follows that in .

Letting F=∧i=1rFi\mathcal{F}=\wedge_{i=1}^{r}\mathcal{F}_{i}, we have by another union bound that

We can perform the following manipulation (for an event A\mathcal{A}, we use the notation ¬A\neg\mathcal{A} to denote the occurrence of the complement of A\mathcal{A}):

and Pr⁡[Fi,j]≥1−O(1/(C′rd))\Pr[\mathcal{F}_{i,j}]\geq 1-O(1/(C^{\prime}rd)). Combining these two, we have

for C′>0C^{\prime}>0 a sufficiently large constant. Plugging (22) into the above,

We thus have, combining (23) with Markov’s inequality,

As C′C^{\prime} can be chosen sufficiently large, while CC is the fixed constant of Lemma 33, we have that

The lemma now follows by appropriately setting the constant CC in the lemma statement.

where the last equality used that y1,…,yd{\mathbf{y}}^{1},\ldots,{\mathbf{y}}^{d} is an Auerbach basis.

Hence, the statement of the theorem holds with probability at least 9/109/10, by a union bound over the events in the dilation and contraction arguments. This concludes the proof.

5 Subspace embeddings using exponential random variables

We now describe a speedup over the previous section using exponential random variables, as in . Other speedups are possible, using , though the results in additionally also slightly improve the sampling complexity. The use of exponential random variables in is inspired by an elegant work of Andoni, Onak, and Krauthgamer on frequency moments .

An exponential distribution has support x∈[0,∞)x\in[0,\infty), probability density function f(x)=e−xf(x)=e^{-x} and cumulative distribution function F(x)=1−e−xF(x)=1-e^{-x}. We say a random variable XX is exponential if XX is chosen from the exponential distribution. The exponential distribution has the following max-stability property.

If U1,…,UnU_{1},\ldots,U_{n} are exponentially distributed, and αi>0 (i=1,…,n)\alpha_{i}>0\ (i=1,\ldots,n) are real numbers, then max⁡{α1/U1,…,αn/Un}≃(∑i∈[n]αi)/U\textstyle\max\{\alpha_{1}/U_{1},\ldots,\alpha_{n}/U_{n}\}\simeq\left(\sum_{i\in[n]}\alpha_{i}\right)\left/U\right., where UU is exponential.

The following lemma shows a relationship between the Cauchy distribution and the exponential distribution.

Let y1,…,yd≥0y_{1},\ldots,y_{d}\geq 0 be scalars. Let U1,…,UdU_{1},\ldots,U_{d} be dd independendent exponential random variables, and let X=(∑i∈[d]yi2/Ui2)1/2X=(\sum_{i\in[d]}y_{i}^{2}/U_{i}^{2})^{1/2}. Let C1,…,CdC_{1},\ldots,C_{d} be dd independent Cauchy random variables, and let Y=(∑i∈[d]yi2Ci2)1/2Y=(\sum_{i\in[d]}y_{i}^{2}C_{i}^{2})^{1/2}. There is a constant γ>0\gamma>0 for which for any t>0t>0.

Proof: We would like the density function hh of yi2Ci2y_{i}^{2}C_{i}^{2}. Letting t=yi2Ci2t=y_{i}^{2}C_{i}^{2}, the inverse function is Ci=t1/2/yiC_{i}=t^{1/2}/y_{i}. Taking the derivative, we have dCidt=12yit−1/2{dC_{i}\over dt}={1\over 2y_{i}}t^{-1/2}. Letting f(t)=2π11+t2f(t)={2\over\pi}{1\over 1+t^{2}} be the density function of the absolute value of a Cauchy random variable, we have by the change of variable technique,

We would also like the density function kk of yi2Ei2y_{i}^{2}E_{i}^{2}, where Ei∼1/UiE_{i}\sim 1/U_{i}. Letting t=yi2Ei2t=y_{i}^{2}E_{i}^{2}, the inverse function is Ei=t1/2/yiE_{i}=t^{1/2}/y_{i}. Taking the derivative, dEidt=12yit−1/2{dE_{i}\over dt}={1\over 2y_{i}}t^{-1/2}. Letting g(t)=t−2e−1/tg(t)=t^{-2}e^{-1/t} be the density function of the reciprocal of an exponential random variable, we have by the change of variable technique,

We claim that k(t)≤h(γt)/γk(t)\leq h(\gamma t)/\gamma for a sufficiently small constant γ>0\gamma>0. This is equivalent to showing that

which for γ<1\gamma<1, is implied by showing that

We distinguish two cases: first suppose t≥yi2t\geq y_{i}^{2}. In this case, e−yi/t1/2≤1e^{-y_{i}/t^{1/2}}\leq 1. Note also that yit1/2≤t3/2/yiy_{i}t^{1/2}\leq t^{3/2}/y_{i} in this case. Hence, γ1/2yit1/2≤γ1/2t3/2/yi\gamma^{1/2}y_{i}t^{1/2}\leq\gamma^{1/2}t^{3/2}/y_{i}. Therefore, the above is implied by showing

which holds for a sufficiently small constant γ∈(0,1)\gamma\in(0,1).

Next suppose t<yi2t<y_{i}^{2}. In this case yit1/2>t3/2/yiy_{i}t^{1/2}>t^{3/2}/y_{i}, and it suffices to show

Using that ex≥x2/2e^{x}\geq x^{2}/2 for x≥0x\geq 0, it suffices to show

which holds for a small enough γ∈(0,1)\gamma\in(0,1).

where we made the change of variables si=κtis_{i}=\kappa t_{i}. Setting γ=κ1/2\gamma=\kappa^{1/2} completes the proof.

We need a bound on Pr⁡[Y≥t]\Pr[Y\geq t], where Y=(∑i∈[d]yi2Ci2)1/2Y=(\sum_{i\in[d]}y_{i}^{2}C_{i}^{2})^{1/2} is as in Lemma 38.

There is a constant c>0c>0 so that for any r>0r>0,

Proof: For i∈[d]i\in[d], let σi∈{−1,+1}\sigma_{i}\in\{-1,+1\} be i.i.d. random variables with Pr⁡[σi=−1]=Pr⁡[σi=1]=1/2\Pr[\sigma_{i}=-1]=\Pr[\sigma_{i}=1]=1/2. Let Z=∑i∈[d]σiyiCiZ=\sum_{i\in[d]}\sigma_{i}y_{i}C_{i}. We will obtain tail bounds for ZZ in two different ways, and use this to establish the lemma.

On the one hand, by the 11-stability of the Cauchy distribution, we have that Z∼∥y∥1CZ\sim\|y\|_{1}C, where CC is a standard Cauchy random variable. Note that this holds for any fixing of the σi\sigma_{i}. The cumulative distribution function of the Cauchy random variable is F(z)=2πarctan⁡(z).F(z)={2\over\pi}\arctan(z). Hence for any r>0r>0,

and therefore using the Taylor series for arctan⁡\arctan for r>1r>1,

On the other hand, for any fixing of C1,…,CdC_{1},\ldots,C_{d}, we have

If R≥0R\geq 0 is a random variable with finite variance, and 0<θ<10<\theta<1, then

Applying this inequality with R=Z2R=Z^{2} and θ=1/2\theta=1/2, we have

Suppose, towards a contradiction, that Pr⁡[Y≥r∥y∥1]≥c/r\Pr[Y\geq r\|y\|_{1}]\geq c/r for a sufficiently large constant c>0c>0. By independence of the σi\sigma_{i} and the CiC_{i}, by (26) this implies

By (25), this is a contradiction for c>24πc>{24\over\pi}. It follows that Pr⁡[Y≥r∥y∥1]<c/r\Pr[Y\geq r\|y\|_{1}]<c/r, as desired.

Let y1,…,yd≥0y_{1},\ldots,y_{d}\geq 0 be scalars. Let U1,…,UdU_{1},\ldots,U_{d} be dd independendent exponential random variables, and let X=(∑i∈[d]yi2/Ui2)1/2X=(\sum_{i\in[d]}y_{i}^{2}/U_{i}^{2})^{1/2}. There is a constant c>0c>0 for which for any r>0r>0,

Proof: The corollary follows by combining Lemma 38 with Lemma 39, and rescaling the constant cc from Lemma 39 by 1/γ1/\gamma, where γ\gamma is the constant of Lemma 38.

For the dilation, we need Khintchine’s inequality.

(). Let Z=∑i=1rσiziZ=\sum_{i=1}^{r}\sigma_{i}z_{i} for i.i.d. random variables σi\sigma_{i} uniform in {−1,+1}\{-1,+1\}, and z1,…,zrz_{1},\ldots,z_{r} be scalars. There exists a constant c>0c>0 for which for all t>0t>0

which we denote by event E\mathcal{E} and condition on. Notice that the probability is taken only over the choice of the σi\sigma_{i}, and therefore conditions only the σi\sigma_{i} random variables.

In the following, i∈[d]i\in[d] and j∈[r]j\in[r]. Let Fi,j\mathcal{F}_{i,j} be the event that

Letting p=Pr⁡[E∧Fi,j]≥99/100p=\Pr[\mathcal{E}\wedge\mathcal{F}_{i,j}]\geq 99/100, we have by Corollary 40,

We can perform the following manipulation:

It follows by linearity of expectation that,

Consequently, by a Markov bound, and using that p≥1/2p\geq 1/2, conditioned on E∧F\mathcal{E}\wedge\mathcal{F}, with probability at least 9/109/10, we have the occurrence of the event G\mathcal{G} that

where the first inequality uses the triangle inequality, the second the occurrence of E\mathcal{E}, and the third (28). This completes the proof.

Proof: The corollary follows by combining Theorem 30, Lemma 32 and its optimization in §3.3, and Theorem 41.

6 Application to hyperplane fitting

For the subspace approximation problem, we can write

Low Rank Approximation

We will show how to use sketching to speed up algorithms for both problems, and further variants. Our exposition is based on combinations of several works in this area by Sárlos, Clarkson, and the author .

Section Overview: In §4.1 we give an algorithm for computing a low rank approximation achieving error proportional to the Frobenius norm. In §4.2 we give a different kind of low rank approximation, called a CUR decomposition, which computes a low rank approximation also achieving Frobenius norm error but in which the column space equals the span of a small subset of columns of the input matrix, while the row space equals the span of a small subset of rows of the input matrix. A priori, it is not even clear why such a low rank approximation should exist, but we show that it not only exists, but can be computed in nearly input sparsity time. We also show that it can be computed deterministically in polynomial time. This algorithm requires several detours into a particular kind of spectral sparsification given in §4.2.1, as well as an adaptive sampling technique given in §4.2.2. Finally in §4.2.3 we show how to put the pieces together to obtain the overall algorithm for CUR factorization. One tool we need is a way to compute the best rank-kk approximation of the column space of a matrix when it is restricted to lie within a prescribed subspace; we defer the details of this to §4.4, where the tool is developed in the context of an application called Distributed Low Rank Approximation. In §4.3 we show how to perform low rank approximation with a stronger guarantee, namely, an error with respect to the spectral norm. While the solution quality is much better than in the case of the Frobenius norm, it is unknown how to compute this as quickly, though one can still compute it much more quickly than the SVD. In §4.4 we present the details of the Distributed Low Rank Approximation algorithm.

Rescaling ε\varepsilon by a constant factor completes the proof.

Fortunately, we can cast this projection problem as a regression problem, and solve it approximately.

implying the first part of the theorem after rescaling ε\varepsilon by a constant factor.

For the second part of the theorem, note that Lemma 45 gives the stronger guarantee that

2 CUR decomposition

We now outline the approach of Boutsidis and the author . A key lemma we need is the following, which is due to Boutsidis, Drineas, and Magdon-Ismail .

as needed. The lemma now follows by Markov’s bound.

To proceed, we need an algorithm in the next subsection, which uses a method of Batson, Spielman, and Srivastava refined for this application by Boutsidis, Drineas, and Magdon-Ismail .

The following theorem shows correctness of the Deterministic Dual Set Spectral Sparsification algorithm described in Algorithm 2.

We now turn to correctness. The crux of the analysis turns out to be to show there always exists an index jj in each iteration for which

We start with a lemma which uses the Sherman-Morrison-Woodbury identity to analyze a rank-11 perturbation.

For the second part, we use the following well-known formula.

Letting L′=L+δLOWL^{\prime}=L+\delta_{LOW}, we have

We also need the following lemma concerning properties of the UPUP function.

or equivalently, taTa≤δUPt{\mathbf{a}}^{T}{\mathbf{a}}\leq\delta_{UP}. Hence,

Equipped with Lemma 51 and Lemma 52, we now prove the main lemma we need.

At every iteration τ=0,…,r−1\tau=0,\ldots,r-1, there exists an index j∈{1,2,…,n}j\in\{1,2,\ldots,n\} for which

Indeed, if we show (33), then by averaging there must exist an index jj for which

We first prove the equality in (33) using the definition of δUP\delta_{UP}. Observe that it holds that

We will show E≥0\mathcal{E}\geq 0 below. Given this, we have

where the inequality uses Lemma 51. Since δLOW=1\delta_{LOW}=1, we have

We now turn to the task of showing E≥0\mathcal{E}\geq 0. The Cauchy-Schwarz inequality implies that for ai,bi≥0a_{i},b_{i}\geq 0, one has (∑iaibi)2≤(∑iai2bi)(∑ibi)(\sum_{i}a_{i}b_{i})^{2}\leq(\sum_{i}a_{i}^{2}b_{i})(\sum_{i}b_{i}), and therefore

Plugging into (34), we conclude that E≥0\mathcal{E}\geq 0, as desired.

By Lemma 53, the algorithm is well-defined, finding a t≥0t\geq 0 at each iteration (note that t≥0t\geq 0 since t−1≥UP(aj,δUP)≥0t^{-1}\geq UP(a_{j},\delta_{UP})\geq 0).

Finally, note that Algorithm 2 runs in rr steps. The vector ss of weights is initialized to the all-zero vector, and one of its entries is updated in each iteration. Thus, ss will contain at most rr non-zero weights upon termination. As shown above, the value tt chosen in each iteration is non-negative, so the weights in ss are non-negative.

We will also need the following corollary, which shows how to perform the dual set sparsification much more efficiently if we allow it to be randomized.

Lemma 55 gives us a way to find 4k4k columns providing an O(1)O(1)-approximation. We would like to refine this approximation to a (1+ε)(1+\varepsilon)-approximation using only an additional O(k/ε)O(k/\varepsilon) number of columns. To do so, we perform a type of residual sampling from this O(1)O(1)-approximation, as described in the next section.

2.2 Adaptive sampling

For i=1,…,ni=1,\ldots,n, and some fixed constant α>0,\alpha>0, let pip_{i} be a probability distribution such that for each i:i:

For i=1,…,ni=1,\ldots,n let pip_{i} be a probability distribution such that for each i:i:

To analyze the expected error of the algorithm with respect to the choices made in the sampling procedure, we have

where the second equality uses the Pythagorean theorem.

2.3 CUR wrapup

Hence, for a parameter c2>0c_{2}>0, if we set

3 Spectral norm error

We also collect a few facts about the singular values of a Gaussian matrix.

In order to analyze SubspacePowerMethod, we need a key lemma shown in concerning powering of a matrix.

If we raise both sides to the 1/(2(2q+1))1/(2(2q+1))-th power, then this completes the proof.

We can now prove the main theorem about SubspacePowerMethod

4 Distributed low rank approximation

The main algorithm AdaptiveCompress of is given in Algorithm AdaptiveCompress below.

Graph Sparsification

We formally define the problem as follows, following the notation and outlines of . Consider an ordering on the nn vertices, denoted 1,…,n1,\ldots,n. We will only consider undirected graphs, though we will often talk about edges e={u,v}e=\{u,v\} as e=(u,v)e=(u,v), where here uu is less than vv in the ordering we have placed on the edges. This will be for notational convenience only; the underlying graphs are undirected.

We call HH a spectral sparsifier of GG The usual notation for (57) is

Notice that Theorem 64 shows that if one knows the leverage scores, then by sampling O(nε−2log⁡n)O(n\varepsilon^{-2}\log n) edges of GG and reweighting them, one obtains a spectral sparsifier of GG. One can use algorithms for approximating the leverage scores of general matrices , though more efficient algorithms, whose overall running time is near-linear in the number of edges of GG, are known .

A beautiful theorem of Kapralov, Lee, Musco, Musco, and Sidford is the following .

In the remainder of the section, we give an outline of the proof of Theorem 65, following the exposition given in . We restrict to unweighted graphs for the sake of presentation; the arguments generalize in a natural way to weighted graphs.

The proof of the following theorem is elementary. We believe the power in the theorem is its novel use in algorithm design.

For the second condition, for all x{\mathbf{x}},

Finally, for the third condition, for all x{\mathbf{x}},

The bounds on the eigenvalues of a Laplacian are given in (the bound on the maximum eigenvalue follows from the fact that nn is the maximum eigenvalue of the Laplacian of the complete graph on nn vertices. The bound on the minimum eigenvalue follows from Lemma 6.1 of ).

To do this, first observe that the leverage score for a potential edge i=(u,v)i=(u,v) is given by

Then, by the second property of Theorem 66,

Thus, the only task left is to implement this hierarchy of leverage score sampling using linear sketches.

For this, we need the following standard theorem from the sparse recovery literature.

Several standard consequences of this theorem, as observed in , can be derived by setting η=εClog⁡n\eta={\varepsilon\over C\log n} for a constant C>0C>0, which is the setting of η\eta we use throughout. Of particular interest is that for 0<ε<1/20<\varepsilon<1/2, from wiw_{i} one can determine if xi≥1Clog⁡n∥x∥2{\mathbf{x}}_{i}\geq{1\over C\log n}\|{\mathbf{x}}\|_{2} or xi<12Clog⁡n∥x∥2{\mathbf{x}}_{i}<{1\over 2C\log n}\|{\mathbf{x}}\|_{2} given that it satisfies one of these two conditions. We omit the proof of this fact which can be readily verified from the statement of Theorem 67, as shown in .

Sketching Lower Bounds for Linear Algebra

While sketching, and in particular subspace embeddings, have been used for a wide variety of applications, there are certain limitations. In this section we explain some of them.

While our focus in this section is on lower bounds, we mention that for integers p≥1p\geq 1, there is the following simple algorithm for estimating Schatten norms which has a good running time but requires multiple passes over the data. This is given in .

Proof: Let r=C/ε2r=C/\varepsilon^{2} for a positive constant C>0C>0. Suppose g1,…,gr{\mathbf{g}}^{1},\ldots,{\mathbf{g}}^{r} are independent N(0,1)dN(0,1)^{d} vectors, that is, they are independent vectors of i.i.d. normal random variables with mean and variance 11.

where we use that E[(hi)i2]=1{\bf E}[({\mathbf{h}}^{i})_{i}^{2}]=1 for all ii. We also have that

This shows correctness. The running time follows from our bound on rr and the number ss of passes.

2 Sketching the operator norm

The idea is to use the min-max principle for singular values.

Proof: The min-max principle for singular values says that

The lemma now follows from the min-max principle for singular values, since every vector in the range has its norm preserved up to a factor of 1+ε1+\varepsilon, and so this also holds for any ii-dimensional subspace of the range, for any ii.

μ\mu is the distribution on n×nn\times n matrices with i.i.d. N(0,1)N(0,1) entries.

It follows with probability 1−O(1/n)1-O(1/n), by the triangle inequality

In our proof we need the following tail bound due to Latała Suppose that gi1,…,gidg_{i_{1}},\dots,g_{i_{d}} are i.i.d. N(0,1)N(0,1) random variables. The following result, due to Latała , bounds the tails of Gaussian chaoses ∑ai1⋯aidgi1⋯gid\sum a_{i_{1}}\cdots a_{i_{d}}g_{i_{1}}\cdots g_{i_{d}}. The proof of Latała’s tail bound was later simplified by Lehec .

where Cd,cd>0C_{d},c_{d}>0 are constants depending only on dd.

To prove the main theorem of this section, we need a few facts about distances between distributions.

In general Dϕ(μ∣∣ν)D_{\phi}(\mu||\nu) is not a distance because it is not symmetric.

The total variation distance between μ\mu and ν\nu, denoted by dTV(μ,ν)d_{TV}(\mu,\nu), is defined as Dϕ(μ∣∣ν)D_{\phi}(\mu||\nu) for ϕ(x)=∣x−1∣\phi(x)=|x-1|. It can be verified that this is indeed a distance. It is well known that if dTV(μ,ν)≤c<1d_{TV}(\mu,\nu)\leq c<1, then the probability that any, possibly randomized algorithm, can distinguish the two distributions is at most (1+c)/2(1+c)/2.

The χ2\chi^{2}-divergence between μ\mu and ν\nu, denoted by χ2(μ∣∣ν)\chi^{2}(\mu||\nu), is defined as Dϕ(μ∣∣ν)D_{\phi}(\mu||\nu) for ϕ(x)=(x−1)2\phi(x)=(x-1)^{2} or ϕ(x)=x2−1\phi(x)=x^{2}-1. It can be verified that these two choices of ϕ\phi give exactly the same value of Dϕ(μ∣∣ν)D_{\phi}(\mu||\nu).

We can upper bound total variation distance in terms of the χ2\chi^{2}-divergence using the next proposition.

dTV(μ,ν)≤χ2(μ∣∣ν)d_{TV}(\mu,\nu)\leq\sqrt{\chi^{2}(\mu||\nu)}.

The next proposition gives a convenient upper bound on the χ2\chi^{2}-divergence between a Gaussian distribution and a mixture of Gaussian distributions.

We can now prove the main impossibility theorem about sketching the operator norm up to a constant factor.

Partition of size 1. The only possible partition is {1,2,3,4}\{1,2,3,4\}. We have

Partitions of size 3. Up to symmetry, there are only two partitions to consider: {1,2},{3},{4}\{1,2\},\{3\},\{4\}, and {1,3},{2},{4}\{1,3\},\{2\},\{4\}. We first consider the partition {1,2},{3},{4}\{1,2\},\{3\},\{4\}. We have

where the first inequality follows from Cauchy-Schwarz. We now consider the partition {1,3},{2},{4}\{1,3\},\{2\},\{4\}. We have

where the second equality follows by Cauchy-Schwarz.

Partition of size 4. The only partition is {1},{2},{3},{4}\{1\},\{2\},\{3\},\{4\}. Using that for integers a,ba,b, a⋅b≤(a2+b2)/2a\cdot b\leq(a^{2}+b^{2})/2, we have

Latała’s inequality (Theorem 72) states that for t>0t>0,

The above holds with no conditions imposed on u,v,u′,v′{\mathbf{u}},{\mathbf{v}},{\mathbf{u}}^{\prime},{\mathbf{v}}^{\prime}. For convenience, we let

Note that conditioned on Eu,v\mathcal{E}_{{\mathbf{u}},{\mathbf{v}}} and Eu′,v′\mathcal{E}_{{\mathbf{u}}^{\prime},{\mathbf{v}}^{\prime}},

We now claim that tD=25tn≤cf(t)/2tD={25t\over n}\leq cf(t)/2 for all k<t<16k\sqrt{k}<t<16k, provided k=o(n2)k=o(n^{2}). First, note that since t<16kt<16k, tk=O(t){t\over\sqrt{k}}=O(\sqrt{t}). Also, since t>kt>\sqrt{k}, tk≤t2k{t\over\sqrt{k}}\leq{t^{2}\over k}. Hence, f(t)=Θ(min⁡(t/k,t2/3/n1/3))f(t)=\Theta(\min(t/\sqrt{k},t^{2/3}/n^{1/3})). Since k=o(n2)k=o(n^{2}), if t/kt/\sqrt{k} achieves the minimum, then it is larger than 25tn{25t\over n}. On the other hand, if t2/3/n1/3t^{2/3}/n^{1/3} achieves the minimum, then cf(t)/2≥25tncf(t)/2\geq{25t\over n} whenever t=o(n2)t=o(n^{2}), which since t<16k=o(n2)t<16k=o(n^{2}), always holds.

3 Streaming lower bounds

In this section, we explain some basic communication complexity, and how it can be used to prove bit lower bounds for the space complexity of linear algebra problems in the popular streaming model of computation. We refer the reader to Muthukrishnan’s survey for a comprehensive overview on the streaming model. We state the definition of the model that we need as follows. These results are by Clarkson and the author , and we follow the exposition in that paper.

4 Communication complexity

For lower bounds in the turnstile model, we use a few definitions and basic results from two-party communication complexity, described below. We refer the reader to the book by Kushilevitz and Nisasn for more information . We will call the two parties Alice and Bob.

For a function f:X×Y→{0,1}f:\mathcal{X}\times\mathcal{Y}\rightarrow\{0,1\}, we use Rδ1−way(f)R_{\delta}^{1-way}(f) to denote the randomized communication complexity with two-sided error at most δ\delta in which only a single message is sent from Alice to Bob. Here, only a single message M(X)M(X) is sent from Alice to Bob, where MM is Alice’s message function of her input XX and her random coins. Bob computes f(M(X),Y)f(M(X),Y), where ff is a possibly randomized function of M(X)M(X) and Bob’s input YY. For every input pair (X,Y)(X,Y), Bob should output a correct answer with probability at least 1−δ1-\delta, where the probability is taken over the joint space of Alice and Bob’s random coin tosses. If this holds, we say the protocol is correct. The communication complexity Rδ1−way(f)R_{\delta}^{1-way}(f) is then the minimum over correct protocols, of the maximum length of Alice’s message M(X)M(X), over all inputs and all settings to the random coins.

We also use Rμ,δ1−way(f)R_{\mu,\delta}^{1-way}(f) to denote the minimum communication of a protocol, in which a single message from Alice to Bob is sent, for solving ff with probability at least 1−δ1-\delta, where the probability now is taken over both the coin tosses of the protocol and an input distribution μ\mu.

In the augmented indexing problem, which we call AINDAIND, Alice is given x∈{0,1}n{\mathbf{x}}\in\{0,1\}^{n}, while Bob is given both an i∈[n]i\in[n] together with xi+1,xi+2,…,xn{\mathbf{x}}_{i+1},{\mathbf{x}}_{i+2},\ldots,{\mathbf{x}}_{n}. Bob should output xi{\mathbf{x}}_{i}.

() R1/31−way(AIND)=Ω(n)R_{1/3}^{1-way}(AIND)=\Omega(n) and also Rμ,1/31−way(AIND)=Ω(n)R_{\mu,1/3}^{1-way}(AIND)=\Omega(n), where μ\mu is uniform on {0,1}n×[n]\{0,1\}^{n}\times[n].

We start with an example showing how to use Theorem 74 for proving space lower bounds for the Matrix Product problem, which is the same as given in Definition 11. Here we also include in the definition the notions relevant for the streaming model.

Proof: Throughout we shall assume that 1/ε1/\varepsilon is an integer, and that cc is an even integer. These conditions can be removed with minor modifications. Let AlgAlg be a 11-pass algorithm which solves Matrix Product with probability at least 4/54/5. Let r=log⁡10(cn)/(8ε2)r=\log_{10}(cn)/(8\varepsilon^{2}). We use AlgAlg to solve instances of AINDAIND on strings of size cr/2cr/2. It will follow by Theorem 74 that the space complexity of AlgAlg must be Ω(cr)=Ω(clog⁡(cn))/ε2\Omega(cr)=\Omega(c\log(cn))/\varepsilon^{2}.

It follows that the parties can solve the AIND problem with probability at least 4/5−25/198>2/34/5-25/198>2/3. The theorem now follows by Theorem 74.

4.2 Regression and low rank approximation

One can similarly use communication complexity to obtain lower bounds in the streaming model for Regression and Low Rank Approximation. The results are again obtained by reduction from Theorem 74. They are a bit more involved than those for matrix product, and so we only state several of the known theorems regarding these lower bounds. We begin with the formal statement of the problems, which are the same as defined earlier, specialized here to the streaming setting.

() Let ε>0\varepsilon>0 and k≥1k\geq 1 be arbitrary. Then,

5 Subspace embeddings

6 Adaptive algorithms

In this section we would like to point out a word of caution of using a sketch for multiple, adaptively chosen tasks.

with probability at least 1−δ1-\delta for some parameter δ>0\delta>0. In this section we will focus on the case in which δ<n−c\delta<n^{-c} for every constant c>0c>0, that is, δ\delta shrinks faster than any inverse polynomial in nn

Further, the algorithm runs in O(k3)O(k^{3}) time and the first r−1r-1 queries can be chosen non-adaptively (so the algorithm makes a single adaptive query, namely, xr{\mathbf{x}}^{r}).

Proof: The algorithm first queries the sketch on the vectors

We state some of the intuition behind the proof of Theorem 83 below.

Formally, Theorem 83 makes use of a conditional expectation lemma showing that there exists a choice of τ\tau for which

Open Problems

We have attempted to cover a number of examples where sketching techniques can be used to speed up numerical linear algebra applications. We could not cover everything and have of course missed out on some great material. We encourage the reader to look at other surveys in this area, such as the one by Mahoney , for a treatment of some of the topics that we missed.

References