Frequent Directions : Simple and Deterministic Matrix Sketching

Mina Ghashami, Edo Liberty, Jeff M. Phillips, David P. Woodruff

Introduction

The data streaming paradigm considers computation on a large data set AA where data items arrive in arbitrary order, are processed, and then never seen again. It also enforces that only a small amount of memory is available at any given time. This small space constraint is critical when the full data set cannot fit in memory or disk. Typically, the amount of space required is traded off with the accuracy of the computation on AA. Usually the computation results in some summary S(A)S(A) of AA, and this trade-off determines how accurate one can be with the available space resources.

Modern large data sets are often viewed as large matrices. For example, textual data in the bag-of-words model is represented by a matrix whose rows correspond to documents. In large scale image analysis, each row in the matrix corresponds to one image and contains either pixel values or other derived feature values. Other large scale machine learning systems generate such matrices by converting each example into a list of numeric features. Low rank approximations for such matrices are used in common data mining tasks such as Principal Component Analysis (PCA), Latent Semantic Indexing (LSI), and k-means clustering. Regardless of the data source, the optimal low rank approximation for any matrix is obtained by its truncated Singular Value Decompositions (SVD).

In large matrices as above, one processor (and memory) is often incapable of handling all of the dataset AA in a feasible amount of time. Even reading a terabyte of data on a single processor can take many hours. Thus this computation is often spread among some set of machines. This renders standard SVD algorithms infeasible. Given a very large matrix AA, a common approach is to compute in the streaming paradigm a sketch matrix BB that is significantly smaller than the original. A good sketch matrix BB is such that A≈BA\approx B or ATA≈BTBA^{T}A\approx B^{T}B and so computations can be performed on BB rather than on AA without much loss in precision.

In this paper, we propose a fourth approach: frequent directions. It is deterministic and draws on the similarity between the matrix sketching problem and the item frequency estimation problem. We provide additive and relative error bounds for it; we show how to merge summaries computed in parallel on disjoint subsets of data; we show it achieves the optimal tradeoff between space and accuracy, up to constant factors, for any row-update based summary; and we empirically demonstrate that it outperforms exemplars from all of the above described approaches.

2 Item Frequency Approximation

Our algorithm for sketching matrices is an extension of a well known algorithm for approximating item frequencies in streams. The following section shortly overviews the frequency approximation problem. Here, a stream A={a1,⋯ ,an}A=\{a_{1},\cdots,a_{n}\} has nn elements where each ai∈[d]a_{i}\in[d]. Let fj=∣{ai∈A∣ai=j}∣f_{j}=|\{a_{i}\in A\mid a_{i}=j\}| be the frequency of item jj and stands for number of times item jj appears in the stream. It is trivial to produce all item frequencies using O(d)O(d) space simply by keeping a counter for each item. Although this method computes exact frequencies, it uses space linear to the size of domain which might be huge. Therefore, we are interested in using less space and producing approximate frequencies f^j\hat{f}_{j}.

3 Connection to Matrix Sketching

4 Main results

Assuming a constant word size, any randomized matrix approximation streaming algorithm in the row-wise-updates model, which guarantees ∥A−πBk(A)∥F2≤(1+ε)∥A−Ak∥F2\|A-\pi_{B}^{k}(A)\|^{2}_{F}\leq(1+\varepsilon)\|A-A_{k}\|^{2}_{F} and that succeeds with probability at least 2/32/3, must use Ω(kd/ε)\Omega(kd/\varepsilon) space.

Theorem 1.4 claims that FrequentDirections is optimal with respect to the tradeoff between sketch size and resulting accuracy. On the other hand, in terms of running time, FrequentDirections is not known to be optimal.

5 Practical Implications

Frequent Directions

This section proves our main results for Algorithm 1 which is our simplest and most space efficient algorithm. The reader will notice that we occasionally use inequalities instead of equalities at different parts of the proof to obtain three Properties. This is not unintentional. The reason is that we want the same exact proofs to hold also for Algorithm 1 which we describe in Section 3. Algorithm 1 is conceptually identical to Algorithm 1, it requires twice as much space but is far more efficient. Moreover, any algorithm which produces an approximate matrix BB which satisfies the following facts (for any choice of Δ\Delta) will achieve the error bounds stated in Lemma 1.1 and Lemma 1.2.

In what follows, we denote by δi\delta_{i}, B[i]B_{[i]}, C[i]C_{[i]} the values of δ\delta, BB and CC respectively after the iith row of AA was processed. Let Δ=∑i=1nδi\Delta=\sum_{i=1}^{n}\delta_{i}, be the total mass we subtract from the stream during the algorithm. To prove our result we first prove three auxiliary properties.

For any vector xx we have ∥Ax∥2−∥Bx∥2≥0\|Ax\|^{2}-\|Bx\|^{2}\geq 0.

Use the observations that ⟨ai,x⟩2+∥B[i−1]x∥2=∥C[i]x∥2\langle a_{i},x\rangle^{2}+\|B_{[i-1]}x\|^{2}=\|C_{[i]}x\|^{2}.

To see this, first note that ∥C[i]x∥2−∥B[i]x∥2≤∥C[i]TC[i]−B[i]TB[i]∥≤δi\|C_{[i]}x\|^{2}-\|B_{[i]}x\|^{2}\leq\|C_{[i]}^{T}C_{[i]}-B_{[i]}^{T}B_{[i]}\|\leq\delta_{i}. Now, consider the fact that ∥C[i]x∥2=∥B[i−1]x∥2+∥aix∥2\|C_{[i]}x\|^{2}=\|B_{[i-1]}x\|^{2}+\|a_{i}x\|^{2}. Substituting for ∥C[i]x∥2\|C_{[i]}x\|^{2} above and taking the sum yields

Combining this with ∑i∥C[i]x∥2−∥B[i]x∥2≤∑iδi=Δ\sum_{i}\|C_{[i]}x\|^{2}-\|B_{[i]}x\|^{2}\leq\sum_{i}\delta_{i}=\Delta yields that ∥Ax∥2−∥Bx∥2≤Δ\|Ax\|^{2}-\|Bx\|^{2}\leq\Delta. ∎

Now we can show that projecting AA onto BkB_{k} provides a relative error approximation. Here, yiy_{i} correspond to the singular vectors of AA as above and viv_{i} to the singular vectors of BB in a similar fashion.

Running Time Analysis

In extremely large datasets, the processing is often distributed among several machines. Each machine receives a disjoint input of raw data and is tasked with creating a small space summary. Then to get a global summary of the entire data, these summaries need to be combined. The core problem is illustrated in the case of just two machines, each process a data set A1A_{1} and A2A_{2}, where A=[A1;A2]A=[A_{1};A_{2}], and create two summaries B1B_{1} and B2B_{2}, respectively. Then the goal is to create a single summary BB which approximates AA using only B1B_{1} and B2B_{2}. If BB can achieve the same formal space/error tradeoff as each B1B_{1} to A1A_{1} in a streaming algorithm, then the summary is called a mergeable summary .

First note that B′B^{\prime} satisfies all facts with Δ′=Δ1+Δ2\Delta^{\prime}=\Delta_{1}+\Delta_{2}, by additivity of squared spectral norm along any direction xx (e.g. ∥B1x∥2+∥B2x∥2=∥B′x∥2\|B_{1}x\|^{2}+\|B_{2}x\|^{2}=\|B^{\prime}x\|^{2}) and squared Frobenious norms (e.g. ∥B1∥F2+∥B2∥F2=∥B′∥F2\|B_{1}\|_{F}^{2}+\|B_{2}\|_{F}^{2}=\|B^{\prime}\|_{F}^{2}), but has space twice as large as desired. Property 1 is straight forward for BB since BB only shrinks in all directions in relation to B′B^{\prime}. For Property 2 follows by considering any unit vector xx and expanding

This property trivially generalizes to any number of partitions of AA. It is especially useful when the matrix (or data) is distributed across many machines. In this setting, each machine can independently compute a local sketch. These sketches can then be combined in an arbitrary order using FrequentDirections.

2 Worst case update time

Space Lower Bounds

In this section we show that FrequentDirections is space optimal with respect to the guaranteed accuracy. We present nearly-matching lower bounds for each case. We show the number of bits needed is equivalent to dd times the number of rows FrequentDirections requires. We first prove Theorem 1.3 showing the covariance error bound in Theorem 1.1 is nearly tight, regardless of streaming issues.

We start with a simple intuitive lemma showing an Ω(kd)\Omega(kd) lower bound, which we will refer to. We then prove our main Ω(kd/ϵ)\Omega(kd/\epsilon) lower bound.

Any streaming algorithm which, for every input AA, with constant probability (over its internal randomness) succeeds in outputting a matrix RR for which ∥A−AR†R∥F≤(1+ε)∥A−Ak∥F\|A-AR^{\dagger}R\|_{F}\leq(1+\varepsilon)\|A-A_{k}\|_{F} must use Ω(kd)\Omega(kd) bits of space.

Let S\mathcal{S} be the set of kk-dimensional subspaces over the vector space GF(2)dGF(2)^{d}, where GF(2)GF(2) denotes the finite field of 22 elements with the usual modulo 22 arithmetic. The cardinality of S\mathcal{S} is known to be

where the inequalities assume that k≤d/3k\leq d/3.

where α,β1,…,βk\alpha,\beta_{1},\ldots,\beta_{k} are integers. We can assume that the greatest common divisor (gcd) of α,β1,…,βk\alpha,\beta_{1},\ldots,\beta_{k} is 11, otherwise the same conclusion holds after we divide α,β1,…,βk\alpha,\beta_{1},\ldots,\beta_{k} by the gcd. Note that (1) implies that αv=∑iβiAi2 mod 2\alpha v=\sum_{i}\beta_{i}A^{2}_{i}\bmod 2, i.e., when we take each of the coordinates modulo 22. Since the βi\beta_{i} cannot all be divisible by 22 (since α\alpha would then be odd and so by the gcd condition the left hand side would contain a vector with at least one odd coordinate, contradicting that the right hand side is a vector with even coordinates), and the rows of A2A^{2} form a basis over GF(2d)GF(2^{d}), the right hand side must be non-zero, which implies that α=1 mod 2\alpha=1\bmod 2. This implies that vv is in the span of the rows of A2A^{2} over GF(2d)GF(2^{d}), a contradiction.

where ∣R∣|R| denotes the expected length of the encoding of RR, HH is the entropy function, and II is the mutual information. For background on information theory, see . This completes the proof. ∎

2 Intuition for Main Lower Bound

The only other lower bounds for streaming algorithms for low rank approximation that we know of are due to Clarkson and Woodruff . As in their work, we use the Index problem in communication complexity to establish our bounds, which is a communication game between two players Alice and Bob, holding a string x∈{0,1}rx\in\{0,1\}^{r} and an index i∈[r]=:{1,2,…,r}i\in[r]\mathrel{\mathop{=}}:\{1,2,\ldots,r\}, respectively. In this game Alice sends a single message to Bob who should output xix_{i} with constant probability. It is known (see, e.g., ) that this problem requires Alice’s message to be Ω(r)\Omega(r) bits long. If Alg is a streaming algorithm for low rank approximation, and Alice can create a matrix AxA_{x} while Bob can create a matrix BiB_{i} (depending on their respective inputs xx and ii), then if from the output of Alg on the concatenated matrix [Ax;Bi][A_{x};B_{i}] Bob can output xix_{i} with constant probability, then the memory required of Alg is Ω(r)\Omega(r) bits, since Alice’s message is the state of Alg after running it on AxA_{x}.

The main technical challenges are thus in showing how to choose AxA_{x} and BiB_{i}, as well as showing how the output of Alg on [Ax;Bi][A_{x};B_{i}] can be used to solve Index. This is where our work departs significantly from that of Clarkson and Woodruff . Indeed, a major challenge is that in Theorem 1.4, we only require the output to be the matrix RR, whereas in Clarkson and Woodruff’s work from the output one can reconstruct AR†RAR^{\dagger}R. This causes technical complications, since there is much less information in the output of the algorithm to use to solve the communication game.

The intuition behind the proof of Theorem 1.4 is that given a 2×d2\times d matrix A=[1,x;1,0d]A=[1,x;1,0^{d}], where xx is a random unit vector, then if P=R†RP=R^{\dagger}R is a sufficiently good projection matrix for the low rank approximation problem on AA, then the second row of APAP actually reveals a lot of information about xx. This may be counterintuitive at first, since one may think that [1,0d;1,0d][1,0^{d};1,0^{d}] is a perfectly good low rank approximation. However, it turns out that [1,x/2;1,x/2][1,x/2;1,x/2] is a much better low rank approximation in Frobenius norm, and even this is not optimal. Therefore, Bob, who has [1,0d][1,0^{d}] together with the output PP, can compute the second row of APAP, which necessarily reveals a lot of information about xx (e.g., if AP≈[1,x/2;1,x/2]AP\approx[1,x/2;1,x/2], its second row would reveal a lot of information about xx), and therefore one could hope to embed an instance of the Index problem into xx. Most of the technical work is about reducing the general problem to this 2×d2\times d primitive problem.

3 Proof of Main Lower Bound for Preserving Subspaces

Now let c>0c>0 be a small constant to be determined. We consider the following two player problem between Alice and Bob: Alice has a ck/ε×dck/\varepsilon\times d matrix AA which can be written as a block matrix [I,R][I,R], where II is the ck/ε×ck/εck/\varepsilon\times ck/\varepsilon identity matrix, and RR is a ck/ε×(d−ck/ε)ck/\varepsilon\times(d-ck/\varepsilon) matrix in which the entries are in {−1/(d−ck/ε)1/2,+1/(d−ck/ε)1/2}\{-1/(d-ck/\varepsilon)^{1/2},+1/(d-ck/\varepsilon)^{1/2}\}. Here [I,R][I,R] means we append the columns of II to the left of the columns of RR; see Figure 1. Bob is given a set of kk standard unit vectors ei1,…,eike_{i_{1}},\ldots,e_{i_{k}}, for distinct i1,…,ik∈[ck/ε]={1,2,…,ck/ε}i_{1},\ldots,i_{k}\in[ck/\varepsilon]=\{1,2,\ldots,ck/\varepsilon\}. Here we need c/ε>1c/\varepsilon>1, but we can assume ε\varepsilon is less than a sufficiently small constant, as otherwise we would just need to prove an Ω(kd)\Omega(kd) lower bound, which is established by Lemma 4.1.

Denote this problem by ff. We will show the randomized 11-way communication complexity of this problem R1/41−way(f)R^{1-way}_{1/4}(f), in which Alice sends a single message to Bob and Bob fails with probability at most 1/41/4, is Ω(kd/ε)\Omega(kd/\varepsilon) bits. More precisely, let μ\mu be the following product distribution on Alice and Bob’s inputs: the entries of RR are chosen independently and uniformly at random in {−1/(d−ck/ε)1/2,+1/(d−ck/ε)1/2}\{-1/(d-ck/\varepsilon)^{1/2},+1/(d-ck/\varepsilon)^{1/2}\}, while {i1,…,ik}\{i_{1},\ldots,i_{k}\} is a uniformly random set among all sets of kk distinct indices in [ck/ε][ck/\varepsilon]. We will show that Dμ,1/41−way(f)=Ω(kd/ε)D^{1-way}_{\mu,1/4}(f)=\Omega(kd/\varepsilon), where Dμ,1/41−way(f)D^{1-way}_{\mu,1/4}(f) denotes the minimum communication cost over all deterministic 11-way (from Alice to Bob) protocols which fail with probability at most 1/41/4 when the inputs are distributed according to μ\mu. By Yao’s minimax principle (see, e.g., ), R1/41−way(f)≥Dμ,1/41−way(f)R^{1-way}_{1/4}(f)\geq D^{1-way}_{\mu,1/4}(f).

We use the following two-player problem Index in order to lower bound Dμ,1/41−way(f)D^{1-way}_{\mu,1/4}(f). In this problem Alice is given a string x∈{0,1}rx\in\{0,1\}^{r}, while Bob is given an index i∈[r]i\in[r]. Alice sends a single message to Bob, who needs to output xix_{i} with probability at least 2/32/3. Again by Yao’s minimax principle, we have that R1/31−way(Index)≥Dν,1/31−way(Index)R^{1-way}_{1/3}({\sf Index})\geq D^{1-way}_{\nu,1/3}({\sf Index}), where ν\nu is the distribution for which xx and ii are chosen independently and uniformly at random from their respective domains. The following is well-known.

Dν,1/31−way(Index)=Ω(r).D^{1-way}_{\nu,1/3}({\sf Index})=\Omega(r).

For cc a small enough positive constant, and d≥k/εd\geq k/\varepsilon, we have Dμ,1/41−way(f)=Ω(dk/ε)D^{1-way}_{\mu,1/4}(f)=\Omega(dk/\varepsilon).

We proceed to lower bound ∥B−BP∥F2\|B-BP\|_{F}^{2} in a certain way, which will allow our reduction to Index to be carried out. We need the following fact:

((2.4) of ) Let AA be an m×nm\times n matrix with i.i.d. entries which are each +1/n+1/\sqrt{n} with probability 1/21/2 and −1/n-1/\sqrt{n} with probability 1/21/2, and suppose m/n<1m/n<1. Then for all t>0t>0,

where α,α′>0\alpha,\alpha^{\prime}>0 are absolute constants. Here ∥A∥2\|A\|_{2} is the operator norm sup⁡x∥Ax∥∥x∥\sup_{x}\frac{\|Ax\|}{\|x\|} of AA.

We apply Fact 4.2 to the matrix RR, which implies,

and using that d≥k/εd\geq k/\varepsilon and c>0c>0 is a sufficiently small constant, this implies

where β>0\beta>0 is an absolute constant (depending on cc). Note that for c>0c>0 sufficiently small, (1+3c)2≤1+7c(1+3\sqrt{c})^{2}\leq 1+7\sqrt{c}. Let E\mathcal{E} be the event that ∥R∥22≤1+7c\|R\|_{2}^{2}\leq 1+7\sqrt{c}, which we condition on.

We partition the rows of BB into B1B_{1} and B2B_{2}, where B1B_{1} contains those rows whose projection onto the first ck/εck/\varepsilon coordinates equals eie_{i} for some i∉{i1,…,ik}i\notin\{i_{1},\ldots,i_{k}\}. Note that B1B_{1} is (ck/ε−k)×d(ck/\varepsilon-k)\times d and B2B_{2} is 2k×d2k\times d. Here, B2B_{2} is 2k×d2k\times d since it includes the rows in AA indexed by i1,…,iki_{1},\ldots,i_{k}, together with the rows ei1,…,eike_{i_{1}},\ldots,e_{i_{k}}. Let us also partition the rows of RR into RTR_{T} and RSR_{S}, so that the union of the rows in RTR_{T} and in RSR_{S} is equal to RR, where the rows of RTR_{T} are the rows of RR in B1B_{1}, and the rows of RSR_{S} are the non-zero rows of RR in B2B_{2} (note that kk of the rows are non-zero and kk are zero in B2B_{2} restricted to the columns in RR).

For any unit vector uu, write u=uR+uS+uTu=u_{R}+u_{S}+u_{T}, where S={i1,…,ik},T=[ck/ε]∖SS=\{i_{1},\ldots,i_{k}\},T=[ck/\varepsilon]\setminus S, and R=[d]∖[ck/ε]R=[d]\setminus[ck/\varepsilon], and where uAu_{A} for a set AA is on indices j∉Aj\notin A. Then, conditioned on E\mathcal{E} occurring, ∥Bu∥2≤(1+7c)(2−∥uT∥2−∥uR∥2+2∥uS+uT∥∥uR∥).\|Bu\|^{2}\leq(1+7\sqrt{c})(2-\|u_{T}\|^{2}-\|u_{R}\|^{2}+2\|u_{S}+u_{T}\|\|u_{R}\|).

Let CC be the matrix consisting of the top ck/εck/\varepsilon rows of BB, so that CC has the form [I,R][I,R], where II is a ck/ε×ck/εck/\varepsilon\times ck/\varepsilon identity matrix. By construction of BB, ∥Bu∥2=∥uS∥2+∥Cu∥2\|Bu\|^{2}=\|u_{S}\|^{2}+\|Cu\|^{2}. Now, Cu=uS+uT+RuRCu=u_{S}+u_{T}+Ru_{R}, and so

We will also make use of the following simple but tedious fact.

For x∈x\in, the function f(x)=2x1−x2−x2f(x)=2x\sqrt{1-x^{2}}-x^{2} is maximized when x=1/2−5/10x=\sqrt{1/2-\sqrt{5}/10}. We define ζ\zeta to be the value of f(x)f(x) at its maximum, where ζ=2/5+5/10−1/2≈.618\zeta=2/\sqrt{5}+\sqrt{5}/10-1/2\approx.618.

Setting y2=1−x2y^{2}=1-x^{2}, we can equivalently maximize f(y)=−1+2y1−y2+y2f(y)=-1+2y\sqrt{1-y^{2}}+y^{2}, or equivalently g(y)=2y1−y2+y2g(y)=2y\sqrt{1-y^{2}}+y^{2}. Differentiating this expression and equating to , we have

Multiplying both sides by 1−y2\sqrt{1-y^{2}} one obtains the equation 4y2−2=2y1−y24y^{2}-2=2y\sqrt{1-y^{2}}, and squaring both sides, after some algebra one obtains 5y4−5y2+1=05y^{4}-5y^{2}+1=0. Using the quadratic formula, we get that the maximizer satisfies y2=1/2+5/10y^{2}=1/2+\sqrt{5}/10, or x2=1/2−5/10x^{2}=1/2-\sqrt{5}/10. ∎

Conditioned on E\mathcal{E} occurring, ∥B∥22≤(1+7c)(2+ζ).\|B\|_{2}^{2}\leq(1+7\sqrt{c})(2+\zeta).

Suppose we replace the vector uS+uTu_{S}+u_{T} with an arbitrary vector supported on coordinates in SS with the same norm as uS+uTu_{S}+u_{T}. Then the right hand side of this expression cannot increase, which means it is maximized when ∥uT∥=0\|u_{T}\|=0, for which it equals (1+7c)(2−∥uR∥2+21−∥uR∥2∥uR∥),(1+7\sqrt{c})(2-\|u_{R}\|^{2}+2\sqrt{1-\|u_{R}\|^{2}}\|u_{R}\|), and setting ∥uR∥\|u_{R}\| to equal the xx in Fact 4.3, we see that this expression is at most (1+7c)(2+ζ)(1+7\sqrt{c})(2+\zeta). ∎

Write the projection matrix PP output by the streaming algorithm as UUTUU^{T}, where UU is d×kd\times k with orthonormal columns uiu^{i} (note that R†R=PR^{\dagger}R=P). Applying Lemma 4.2 and Fact 4.3 to each of the columns uiu^{i}, we have:

Using the matrix Pythagorean theorem, we thus have,

Therefore, if Bob succeeds in solving ff on input BB, then,

Comparing (4) and (5), we arrive at, conditioned on E\mathcal{E}:

where c1>0c_{1}>0 is a constant that can be made arbitrarily small by making c>0c>0 arbitrarily small.

Since PP is a projector, ∥BP∥F=∥BU∥F\|BP\|_{F}=\|BU\|_{F}. Write U=U^+UˉU=\hat{U}+\bar{U}, where the vectors in U^\hat{U} are supported on TT, and the vectors in Uˉ\bar{U} are supported on [d]∖T[d]\setminus T. We have,

where the first inequality uses ∥BU^∥F≤∥B∥2∥U^∥F\|B\hat{U}\|_{F}\leq\|B\|_{2}\|\hat{U}\|_{F} and (6), the second inequality uses that event E\mathcal{E} occurs, and the third inequality holds for a constant c2>0c_{2}>0 that can be made arbitrarily small by making the constant c>0c>0 arbitrarily small.

Combining with (5) and using the triangle inequality,

where c3>0c_{3}>0 is a constant that can be made arbitrarily small for c>0c>0 an arbitrarily small constant (note that c2>0c_{2}>0 also becomes arbitrarily small as c>0c>0 becomes arbitrarily small). Hence, ∥BUˉ∥F2≥(2+ζ)k−c3k\|B\bar{U}\|_{F}^{2}\geq(2+\zeta)k-c_{3}k, and together with Corollary 4.1, that implies ∥Uˉ∥F2≥k−c4k\|\bar{U}\|_{F}^{2}\geq k-c_{4}k for a constant c4c_{4} that can be made arbitrarily small by making c>0c>0 arbitrarily small.

Our next goal is to show that ∥B2Uˉ∥F2\|B_{2}\bar{U}\|_{F}^{2} is almost as large as ∥BUˉ∥F2\|B\bar{U}\|_{F}^{2}. Consider any column uˉ\bar{u} of Uˉ\bar{U}, and write it as uˉS+uˉR\bar{u}_{S}+\bar{u}_{R}. Hence,

Suppose ∥RSuˉR∥=τ∥uˉR∥\|R_{S}\bar{u}_{R}\|=\tau\|\bar{u}_{R}\| for a value 0≤τ≤1+7c0\leq\tau\leq 1+7\sqrt{c}. Then

and hence, letting τ1,…,τk\tau_{1},\ldots,\tau_{k} denote the corresponding values of τ\tau for the kk columns of Uˉ\bar{U}, we have

Comparing the square of (7) with (9), we have

where c5>0c_{5}>0 is a constant that can be made arbitrarily small by making c>0c>0 an arbitrarily small constant. Now, ∥Uˉ∥F2≥k−c4k\|\bar{U}\|_{F}^{2}\geq k-c_{4}k as shown above, while since ∥RsuˉR∥=τi∥uˉR∥\|R_{s}\bar{u}_{R}\|=\tau_{i}\|\bar{u}_{R}\| if uˉR\bar{u}_{R} is the ii-th column of Uˉ\bar{U}, by (10) we have

for a constant c6c_{6} that can be made arbitrarily small by making c>0c>0 an arbitarily small constant.

Now ∥RUˉR∥F2≤(1+7c)k\|R\bar{U}_{R}\|_{F}^{2}\leq(1+7\sqrt{c})k since event E\mathcal{E} occurs, and ∥RUˉR∥F2=∥RTUˉR∥F2+∥RSUˉR∥F2\|R\bar{U}_{R}\|_{F}^{2}=\|R_{T}\bar{U}_{R}\|_{F}^{2}+\|R_{S}\bar{U}_{R}\|_{F}^{2} since the rows of RR are the concatenation of rows of RSR_{S} and RTR_{T}, so combining with (11), we arrive at

for a constant c7>0c_{7}>0 that can be made arbitrarily small by making c>0c>0 arbitrarily small.

Combining the square of (7) with (12), we thus have

where the constant c8>0c_{8}>0 can be made arbitrarily small by making c>0c>0 arbitrarily small.

or equivalently, ∥B2−B2P∥F2≤3k−((2+ζ)k−c8k)−(c2k)+2k(((2+ζ)−c8)c2)1/2≤(1−ζ)k+c8k+2k(((2+ζ)−c8)c2)1/2≤(1−ζ)k+c9k\|B_{2}-B_{2}P\|_{F}^{2}\leq 3k-((2+\zeta)k-c_{8}k)-(c_{2}k)+2k(((2+\zeta)-c_{8})c_{2})^{1/2}\leq(1-\zeta)k+c_{8}k+2k(((2+\zeta)-c_{8})c_{2})^{1/2}\leq(1-\zeta)k+c_{9}k for a constant c9>0c_{9}>0 that can be made arbitrarily small by making the constant c>0c>0 small enough. This intuitively says that PP provides a good low rank approximation for the matrix B2B_{2}. Notice that by (15),

Conditioned on event E\mathcal{E}, Δ∈[k−c10k,k+c10k],\Delta\in[k-c_{10}k,k+c_{10}k], where c10>0c_{10}>0 is a constant that can be made arbitrarily small by making c>0c>0 arbitrarily small.

The lemma now follows since c\sqrt{c} and c9c_{9} can be made arbitrarily small by making the constant c>0c>0 small enough. ∎

For the first part of the corollary, observe that

for a constant c14>0c_{14}>0 that can be made arbitrarily small by making c>0c>0 arbitrarily small.

where c15>0c_{15}>0 is a constant that can be made arbitrarily small by making the constant c>0c>0 arbitrarily small.

By a union bound over the occurrence of events E,F\mathcal{E},\mathcal{F}, G\mathcal{G}, and H\mathcal{H}, and the streaming algorithm succeeding (which occurs with probability 3/43/4), it follows that Bob succeeds in solving Index with probability at least 49/51−1/4−c16>2/349/51-1/4-c_{16}>2/3, as required. This completes the proof. ∎

Related Work on Matrix Sketching and Streaming

As mentioned in the introduction, there are a variety of techniques to sketch a matrix. There are also several ways to measure error and models to consider for streaming.

In this paper we focus on the row-update streaming model where each stream elements appends a row to the input matrix AA. A more general model the entry-update model fixes the size of AA at n×dn\times d, but each element indicates a single matrix entry and adds (or subtracts) to its value.

The accuracy of a sketch matrix BB can be measured in several ways. Most commonly one considers an n×dn\times d, rank kk matrix A^\hat{A} that is derived from BB (and sometimes AA) and measures the projection error where proj-err =∥A−A^∥F2/∥A−Ak∥F2=\|A-\hat{A}\|_{F}^{2}/\|A-A_{k}\|_{F}^{2}. When A^\hat{A} can be derived entirely from BB, we call this a construction result, and clearly requires at least Ω(n+d)\Omega(n+d) space. When the space is required to be independent of nn, then A^\hat{A} either implicitly depends on AA, or requires another pass of the data. It can then be defined one of two ways: A^=πBk(A)\hat{A}=\pi_{B}^{k}(A) (as is considered in this paper) takes BkB_{k}, the best rank-kk approximation to BB, and then projects AA onto BkB_{k}; A^=ΠBk(A)\hat{A}=\Pi_{B}^{k}(A) projects AA onto BB, and then takes the best rank-kk approximation of the result. Note that πBk(A)\pi_{B}^{k}(A) is better than ΠBk(A)\Pi_{B}^{k}(A), since it knows the rank-kk subspace to project onto without re-examining AA.

We also consider covariance error where covar-err =∥ATA−BTB∥2/∥A∥F2=\|A^{T}A-B^{T}B\|_{2}/\|A\|_{F}^{2} in this paper. One can also bound ∥ATA−BTB∥2/∥A−Ak∥F2\|A^{T}A-B^{T}B\|_{2}/\|A-A_{k}\|_{F}^{2}, but this has an extra parameter kk, and is less clean. This measure captures the norm of AA along all directions (where as non-construction, projection error only indicates how accurate the choice of subspace is), but still does not require Ω(n)\Omega(n) space.

Sketch paradigms

Given these models, there are several types of matrix sketches. We describe them here with a bit more specificity than in the Introduction, with particular attention to those that can operate in the row-update model we focus on. Specific exemplars are described which are used in out empirical study to follow. The first approach is to sparsify the matrix , by retaining a small number of non-zero. These algorithms typically assume to know the n×dn\times d dimensions of AA, and are thus not directly applicable in out model.

Catalog of Related Bounds.

Recall that the error can be measured in several ways.

If it is not constructive, it is denoted by a P for projection if it uses a projection A^=πBk(A)\hat{A}=\pi_{B}^{k}(A). Alternatively if the weaker form of A^=ΠBk(A)\hat{A}=\Pi_{B}^{k}(A), then this is denoted Pr\textsf{P}_{r} where rr is the rank of BB before the projection.

In most recent results a projection error of 1+ε1+\varepsilon is obtained, and is denoted ε\varepsilonR.

Although in some cases a weaker additive error of the form ∥A−A^∥F2≤∥A−Ak∥F2+ε∥A∥F2\|A-\hat{A}\|^{2}_{F}\leq\|A-A_{k}\|^{2}_{F}+\varepsilon\|A\|^{2}_{F} is achieved and denoted ε\varepsilonA. This can sometimes also be expressed as a spectral norm of the form ∥A−A^∥22≤∥A−Ak∥22+ε∥A∥F2\|A-\hat{A}\|^{2}_{2}\leq\|A-A_{k}\|^{2}_{2}+\varepsilon\|A\|^{2}_{F} (note the error term ε∥A∥F2\varepsilon\|A\|^{2}_{F} still has a Frobenius norm). This is denoted ε\varepsilonL2.

In a few cases the error does not follow these patterns and we specially denote it.

Algorithms are randomized unless it is specified. In all tables we state bounds for a constant probability of failure. If we want to decrease the probability of failure to some parameter δ\delta, we can generally increase the size and runtime by O(log⁡(1/δ))O(\log(1/\delta)).

It is worth noting that under the construction model, and allowing streaming turnstile updates to each element of the matrix, the hashing algorithm has been shown space optimal by Clarkson and Woodruff (assuming each matrix entry requires O(log⁡nd)O(\log nd) bits, and otherwise off by only a O(log⁡nd)O(\log nd) factor). It is randomized and it constructs a decomposition of a rank kk matrix A^\hat{A} that satisfies ∥A−A^∥F≤(1+ε)∥A−Ak∥F\|A-\hat{A}\|_{F}\leq(1+\varepsilon)\|A-A_{k}\|_{F}, with probability at least 1−δ1-\delta. This provides a relative error construction bound of size O((k/ε)(n+d)log⁡(nd))O((k/\varepsilon)(n+d)\log(nd)) bits. They also show an Ω((k/ε)(n+d))\Omega((k/\varepsilon)(n+d)) bits lower bound. Our paper shows that the row-update model is strictly easier with a lower upper bound.

Although not explicitly described in their paper , one can directly use their techniques and analysis to achieve a weak form of a non-construction projection bound. One maintains a matrix B=ASB=AS with m=O((k/ε)log⁡(1/δ))m=O((k/\varepsilon)\log(1/\delta)) columns where SS is a d×md\times m matrix where each entry is chosen from {−1,+1}\{-1,+1\} at random. Then setting A^=πB(A)\hat{A}=\pi_{B}(A), achieves a proj-err=1+ε{\small\textsf{proj-err}}=1+\varepsilon, however BB is rank O((k/ε)log⁡(1/δ))O((k/\varepsilon)\log(1/\delta)) and hence that is the only bound on A^\hat{A} as well.

Experimental Results

The other three baselines are Sampling, Hashing, and Random-projection, described in Section 5.

2 Datasets

We consider the real-world dataset Birds in which each row represents an image of a bird, and each column a feature. This dataset has 11788 data points and 312 features, and we recover rank k=100k=100 for projection error experiments.

3 Results

Similar results in error and runtime are shown on the real Birds data set in Figure 8.

Acknowledgments

The authors thank Qin Zhang for discussion on hardness results. We also thank Stanley Eisenstat, and Mark Tygert for their guidance regarding efficient svd rank-1 updates.

References