Simple and Deterministic Matrix Sketching
Edo Liberty
Introduction
Efficiently obtaining compact approximations, or sketches, of large matrices is a very common and important problem. It is essential for obtaining approximate matrix Singular Value Decompositions (SVD) or low rank approximations of large matrices. It is used in large scale data mining, Latent Semantic Indexing (LSI), -means clustering, Principal Component Analysis (PCA), Linear regression, solving large linear systems, matrix preconditioning, and many other important and commonly performed tasks.
Moreover, modern large data sets are often viewed as large matrices. For example, textual data in the bag-of-words model is stored such that each row in the data matrix corresponds to one document and non zero entries correspond to words in the documents. Such matrices are often extremely large and distributed across many machines. Sketching methods, therefore, are designed to be pass efficient which means the data is read at most a constant number of times. If only one pass is required the computational model is also referred to as the streaming model. The streaming model is especially attractive since the analysis can be performed immediately when the data is collected. In that case its storage can be eliminated altogether.
There are three main matrix sketching approaches which are presented here in an arbitrary order. The first generates a sparser version of the matrix. Sparser matrices are stored more efficiently and can be multiplied by other matrices faster . The second approach is to randomly combine matrix rows . These methods rely on properties of random low dimensional subspaces and strong concentration of measure phenomena. The third is to find a small subset of matrix rows (or columns) which approximate the entire matrix. This problem is known as the Column Subset Selection Problem and has been thoroughly investigated . Recent results obtain algorithms with almost matching lower bounds . Alas, It is not immediately clear how to compare these methods’ results to ours since their objectives are different. They aim to recover a low rank matrix whose column space contains most of space spanned by the matrix top singular vectors. Moreover, most of the above algorithms require several passes over the input matrix. A simple streaming solution to the Column Subset Selection problem is obtained by sampling columns (rows in this case) from the input matrix. The rows are sampled with probability proportional to their squared norm. Despite this algorithm’s apparent simplicity, providing tight bounds for its performance required over a decade of research .
This manuscript proposes a forth approach which draws on the matrix sketching problem’s similarity to the item frequency estimation problem. In what follows, we shortly describe the item frequency approximation problem and a well known solution for it which our proposed algorithm will be based on.
In the item frequency approximation problem there is a universe of items and a stream of item appearances. The frequency of an item is the number of times it appears in the stream. It is trivial to produce these counts using space simply by keeping a counter for each item. Our goal is to use space and produce approximate frequencies such that for all and prescribed precision .
The algorithm
Let be the result of applying Algorithm 1 to matrix with prescribed precision parameter then:
We begin by obtaining the value of by computing the Frobenius norm of . Let , and be the values of , and after the main loop in the algorithm is executed times. For example, is an all zeros matrix and is the returned sketch matrix.
2 Parallelization and sketching sketches
A convenient property of this sketching technique is that it allows for combining sketches. In other words, let and denote two halves of a larger matrix . Also, let and be the sketches computed by the above technique for and respectively. Now let the final sketch, , be the sketch of a matrix which contains both and . It still holds that . To see this we compute for a test vector .
Here we use the fact that for which is a consequence of the derivation above. This property is especially useful when the matrix (or data) is distributed across many machines which is often the case in modern large scale data.
3 Connection to matrix low rank approximation
Experiments
Discussion
This paper draws upon a surprising similarity between two problems, the item frequency approximation problem and the matrix sketching problem. It seems that, in general, solutions to the first can be modified to solve the second but incur an additional factor of in both running time and space requirement. This is true, for example, about sampling. It is also the case for the memory footprint of Frequent-Items which is while for Frequent-Directions it is . But, the update time of Frequent-Items is and that of Frequent-Directions is . It is natural to seek a modified algorithm which exhibits an update time. Another question is whether more advanced algorithms for fining frequent items in streams could also be carried over. A good candidate is the Count Sketch algorithm . Alas, it depends on item hashing in a way which does not naturally translate to the matrix sketching domain.
Acknowledgments: The author truly thanks Petros Drineas, Jelani Nelson, Nir Ailon, Zohar Karnin, and Yoel Shkolnisky for very helpful discussions and pointers.