Frequent Directions: Simple and Deterministic Matrix Sketching

Mina Ghashami, Edo Liberty, Jeff M. Phillips, David P. WoodruffSIAM Journal on Computing 2015

TL;DR

This paper introduces "Frequent Directions," a novel deterministic algorithm for creating compact matrix "sketches" from streaming data. It achieves state-of-the-art space-efficiency and accuracy for low-rank matrix approximation, outperforming existing methods and offering theoretical guarantees that are nearly optimal.

What Problem Does This Paper Address?

Modern datasets are often too large to fit into memory, necessitating "streaming" algorithms that process data one piece at a time with limited memory. For large matrices, a common task is finding a low-rank approximation, which is crucial for applications like Principal Component Analysis (PCA) and Latent Semantic Indexing (LSI). Traditional methods for this, like Singular Value Decomposition (SVD), are computationally expensive and memory-intensive. The challenge is to create a smaller "sketch" of the original matrix that preserves essential information for low-rank approximation, while being efficient in terms of both space and processing time, especially in a streaming setting where data arrives row by row.

Methods

The core contribution is the Frequent Directions algorithm. It's inspired by algorithms for finding frequent items in data streams. The algorithm processes the input matrix row by row, maintaining a sketch matrix $B$ of size $\ell \times d$. At each step, a new row from the input matrix $A$ replaces a row in $B$ that is then "shrunk" using an SVD-based procedure. This shrinking process ensures that no single direction in the sketch is overly reduced, leading to strong theoretical guarantees. The algorithm is deterministic and its sketch is "mergeable," meaning sketches from different data partitions can be combined to form a global sketch. The paper also presents a faster variant, Fast-Frequent Directions, which achieves a better time complexity by using more space.

Datasets

The paper evaluates its algorithms on both synthetic and real-world datasets.

  • Synthetic Datasets: These are generated matrices with a structured signal component and additive Gaussian noise. The parameters varied include signal dimension ($m$), noise ratio ($\eta$), and matrix dimensions ($n \times d$).
  • Real-world Dataset: The "Birds" dataset, containing images of birds with features, was used for evaluation.

Key Insights and Ideas

  • Bridging Item Frequency and Matrix Sketching: The paper ingeniously connects the problem of finding frequent items in a stream to the problem of low-rank matrix approximation. This analogy is key to the algorithm's design and its theoretical guarantees.
  • Deterministic and Mergeable Sketches: Unlike many randomized sketching methods, Frequent Directions is deterministic, offering reproducible results. Its mergeable property is crucial for parallel and distributed processing of massive datasets.
  • Near-Optimal Space-Error Tradeoff: The theoretical bounds derived for Frequent Directions are shown to be nearly optimal, meaning it's difficult to achieve better accuracy for a given sketch size.
  • Practical Performance: Empirically, Frequent Directions consistently outperforms other streaming algorithms, especially in terms of accuracy, often achieving better results than predicted by its theoretical worst-case bounds.

Key Results

  • Theoretical Guarantees:
    • Covariance error bound: $\|A^TA - B^TB\|_2 \leq \|A - A_k\|_F^2 / (\ell-k)$, which is shown to be nearly optimal.
  • Projection error bound: $\|A - \pi_{B_k}(A)\|_F^2 \leq (1 + \frac{k}{\ell-k}) \|A-A_k\|_F^2$, also near-optimal.
  • Algorithmic Efficiency:
    • The basic Frequent Directions algorithm has a time complexity of $O(nd\ell)$ per row update.
  • The Fast-Frequent Directions variant achieves an amortized update time of $O(dl)$ by using $2\ell$ sketch rows.
  • Empirical Performance: Frequent Directions consistently provides more accurate low-rank approximations than competing methods (Random Projections, Hashing, Sampling) across various synthetic and real-world datasets, particularly in covariance error. While its running time is competitive, it's not always the fastest, but its scalability and parallelizability are significant advantages.

Limitations and Future Work

  • Running Time: While the algorithm offers excellent space-error tradeoffs, its running time is not always the absolute fastest compared to some simpler methods like Hashing, especially for very large datasets. The paper notes that implementations are not heavily optimized.
  • Future Work: The authors suggest that further optimization of implementations could improve practical performance. They also highlight that the theoretical framework could be extended to other streaming models and approximation tasks. The paper's focus on deterministic sketching is a strong point, and exploring its applications in other areas of machine learning and data analysis is a natural next step.

Summary updated

BibTeX
@misc{ghashami2015frequent,
  author = {Mina Ghashami and Edo Liberty and Jeff M. Phillips and David P. Woodruff},
  title = {{Frequent Directions: Simple and Deterministic Matrix Sketching}},
  year = {2015},
  eprint = {1501.01711},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1501.01711},
}
Figure