Source-linked AI summary

Frequent Directions : Simple and Deterministic Matrix Sketching

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

arXiv:1501.01711v2cs.DS

TL;DR

Large streaming matrices require compact summaries because full-data SVD and storage can be infeasible. The paper introduces deterministic Frequent Directions, which extends frequent-item ideas to matrix sketches and provides tight space-error guarantees with mergeable summaries. The method offers additive and relative approximation bounds for general matrices while outperforming exemplar streaming approaches in the reported tradeoff.

  • Problem

    Large matrices often cannot be stored or processed centrally, motivating compact sketches that preserve useful matrix computations under limited space.

  • Method

    Frequent Directions deterministically processes matrix rows into a mergeable sketch, extending the frequent-items strategy to general matrices.

  • Results

    For any k < ℓ, it provides Gram-matrix and low-rank approximation bounds based on ∥A − A_k∥_F^2/(ℓ−k), including additive error ε∥A − A_k∥_F^2 with O(dk + d/ε) space.

  • Takeaways & Limitations

    The method achieves the optimal space-accuracy tradeoff up to constant factors, supports parallel merging, and empirically outperforms exemplars of prior streaming approaches.

Abstract

from arXiv · show

We describe a new algorithm called Frequent Directions for deterministic matrix sketching in the row-updates model. The algorithm is presented an arbitrary input matrix $A \in R^{n \times d}$ one row at a time. It performed $O(d \times \ell)$ operations per row and maintains a sketch matrix $B \in R^{\ell \times d}$ such that for any $k < \ell$ $\|A^TA - B^TB \|_2 \leq \|A - A_k\|_F^2 / (\ell-k)$ and $\|A - π_{B_k}(A)\|_F^2 \leq \big(1 + \frac{k}{\ell-k}\big) \|A-A_k\|_F^2 $ . Here, $A_k$ stands for the minimizer of $\|A - A_k\|_F$ over all rank $k$ matrices (similarly $B_k$) and $π_{B_k}(A)$ is the rank $k$ matrix resulting from projecting $A$ on the row span of $B_k$. We show both of these bounds are the best possible for the space allowed. The summary is mergeable, and hence trivially parallelizable. Moreover, Frequent Directions outperforms exemplar implementations of existing streaming algorithms in the space-error tradeoff.

1 Introduction

Frequent Directions introduces deterministic matrix sketching for streaming data, connecting matrix approximation to frequent-item estimation. It provides space-efficient approximation guarantees for general matrices and supports parallel summary merging.

  • Motivation: Small-memory streaming sketches approximate large matrices when storing or processing the full dataset is infeasible.Sketches enable computations on B rather than A with limited precision loss.
  • Prior approaches: Three prior approaches use sparsification, random projections or hashing, and row or column subset selection.The paper positions Frequent Directions as a fourth matrix-sketching approach.
  • Contribution: Frequent Directions is deterministic, supports mergeable summaries, and empirically outperforms exemplars of the preceding approaches.The method also provides additive and relative error bounds and an optimal space-accuracy tradeoff up to constant factors.
  • Connection to frequent items: Frequent-items estimation extends to matrix sketching by representing item frequencies as squared norms of columns and constructing a weighted basis-vector sketch.For indicator-row matrices, the resulting Gram-matrix error inherits the frequent-items bound.
  • Main results: For any k < ℓ, Frequent Directions bounds spectral Gram-matrix error by ∥A − A_k∥_F^2/(ℓ−k).The bound is expressed equivalently through a positive-semidefinite sandwich between A^T A and B^T B.
  • Main results: Setting ℓ = ⌈k + 1/ε⌉ yields additive error ε∥A − A_k∥_F^2 using O(dk + d/ε) space.The paper also gives a multiplicative error bound for projection-based low-rank approximation.

F . FRE-

Frequent Directions is space-optimal for its approximation guarantees, although its running time is not known to be optimal. Its direction-preservation property also supports practical low-rank model selection.

  • Space and guarantees: The method uses O(ℓd) = O(kd/ε) floating-point numbers and is deterministic.Its projection bound uses a rank-k subspace directly, unlike related bounds that project onto a higher-rank subspace first.
  • Lower bounds: Any algorithm achieving the stated Gram-matrix guarantee requires Ω(dℓ) space under a constant word-size assumption.This establishes tightness for the sketch-size and accuracy tradeoff.
  • Lower bounds: Any randomized row-streaming algorithm achieving the stated rank-k projection guarantee with probability at least 2/3 requires Ω(kd/ε) space.The lower bound applies even to randomized algorithms in the row-wise-updates model.
  • Computation: The running time is O(ndℓ), and mergeable sketches make Frequent Directions embarrassingly parallel.The paper states that running-time optimality is not known.
  • Practical implications: Frequent Directions can identify directions x satisfying ∥Ax∥_2^2 ≥ ε∥A∥_F^2, supporting selection of useful low-rank dimensions.This addresses the practical difficulty of choosing the smallest acceptable rank.

2 Frequent Directions

Frequent Directions maintains a compact sketch by inserting rows, orthogonalizing through an SVD, and shrinking singular directions. Its invariants yield spectral and low-rank projection error bounds.

  • Frequent Directions: Frequent Directions updates an ℓ × d sketch by replacing its zero row, computing an SVD, and shrinking all singular directions by the squared smallest singular value.The shrinkage restores the invariant that the last sketch row is zero.
  • Error bounds: For any vector x, the sketch never exceeds the input quadratic form: ||Ax||^2 − ||Bx||^2 ≥ 0.This is Property 1 of the analysis.
  • Error bounds: For any unit vector x, the quadratic-form loss is bounded by the total shrinkage: ||Ax||^2 − ||Bx||^2 ≤ Δ.Here Δ is the total mass subtracted during the algorithm.
  • Error bounds: For any k < ℓ, the spectral covariance error satisfies ||A^T A − B^T B||_2 ≤ ||A − A_k||_F^2/(ℓ−k).The result follows from the sketch invariants without additional requirements on how B is constructed.
  • Error bounds: Projecting A onto the top-k row span of B provides a relative-error approximation, with the standard parameter choice ℓ = ⌈k + k/ε⌉.The supplied passages identify this as the conclusion of Theorem 1.2.

3 Running Time Analysis

The fast variant reduces the frequency of SVD computations while preserving the analysis, achieving O(ndℓ) total time and O(dℓ) amortized row-update time. Mergeability supports distributed construction and arbitrary-order combination of local sketches.

  • Running time: O(dℓ) time per row is achieved by computing the SVD only once every ℓ + 1 updates, rather than after every inserted row.The resulting total running time is O((n/ℓ)dℓ^2) = O(ndℓ).
  • Running time: The fast algorithm preserves correctness because rows between SVD triggers are merely aggregated, while triggered iterations retain the required shrinkage inequality.The proofs from Section 2.1 therefore continue to apply.
  • Parallelization and merging: FRE­QUENTDIRECTIONS merges local sketches by stacking B1 and B2, then rerunning the sketch algorithm to produce an ℓ-row global summary.The merged sketch inherits the theorem bounds with combined shrinkage Δ1 + Δ2 + δ.
  • Parallelization and merging: The merge procedure extends to any number of data partitions, allowing independently computed local sketches to be combined in arbitrary order.This directly supports distributed processing across many machines.
  • Worst-case updates: O(ndℓ) total time and O(dℓ) amortized update time still leave a worst-case Ω(dℓ^2) update when an SVD is computed.A later two-sketch maintenance scheme uses additional space to guarantee worst-case O(dℓ) updates.

4 Space Lower Bounds

The paper proves that Frequent Directions achieves nearly optimal space–accuracy tradeoffs for covariance and projection guarantees in row-update streaming. The lower bounds use information-theoretic and communication-complexity arguments to show these requirements are unavoidable.

  • Covariance-error lower bound: The covariance error guarantee is nearly tight, establishing space optimality independently of streaming issues.The lower-bound argument shows that representing a sketch satisfying the covariance guarantee requires Ω(dℓ) bits.
  • Covariance-error lower bound: Ω(dℓ) bits are necessary for any sketch satisfying the covariance error bound ∥A^T A − B^T B∥_2 ≤ ∥A − A_k∥_F^2/(ℓ−k).The bound follows because the sketch must encode enough information to distinguish many possible covariance matrices.
  • Covariance-error lower bound: A relative covariance guarantee with error ε requires ℓ = Ω(k + 1/ε), and therefore Ω(dk + d/ε) space.This matches the dependence achieved by Frequent Directions up to constant factors.
  • Projection-error lower bound: For projection error at rank k, achieving a (1+ε) approximation requires Ω(dk/ε) bits in the row-update streaming model.The lower bound applies to sketches whose row span supports projection with Frobenius error at most (1+ε) times the best rank-k error.
  • Projection-error lower bound: The main projection lower bound reduces from the one-way Index problem because a sufficiently accurate projection reveals information about a hidden vector.The construction uses a matrix containing a random unit vector and shows that the projected output can encode information needed to solve Index.
  • Projection-error lower bound: The proof controls how the output projection aligns with constructed subspaces, using concentration bounds whose constants become arbitrarily small as the construction parameter c decreases.The intermediate lemmas establish near-unit projection behavior for most relevant directions under the conditioning event.

5 Related Work on Matrix Sketching and Streaming

Related work includes sparsification, random projections, hashing, sampling, and incremental SVD methods for streaming matrix sketching. These approaches differ in update model, space, runtime, guarantees, and whether they provide construction or projection results.

  • Streaming models: The paper focuses on the row-update model, in which each stream element appends a row to A; entry-update streaming instead modifies individual matrix entries.This model distinction affects which sketching algorithms apply directly.
  • Error measures: Matrix-sketching error is commonly measured through a rank-k approximation’s projection error, while construction results require deriving the approximation entirely from the sketch.The paper distinguishes projection variants based on whether the input matrix must be revisited and how the rank-k subspace is selected.
  • Sketch paradigms: Sparsification retains a small number of nonzero entries, whereas random projection combines rows using random signs and can be computed in streaming fashion with O(ℓd) space.The cited random-projection implementation uses an ℓ × n random matrix and requires O(ℓd) operations per updated row.
  • Sketch paradigms: Hashing aggregates rows into buckets with random signs, while sampling maintains independent reservoir samplers and can use O(d) update time per input row.Hashing is described as feature hashing; sampling may require O(ℓd) worst-case space but less space when sampled rows are sparse.
  • Related low-rank methods: Incremental SVD variants recompute truncated decompositions without the shrinkage step used by Frequent Directions, and no worst-case error bounds are known for them.The paper cites evidence that incremental SVD can fail dramatically, while later variants approach or surpass its performance using Frequent Directions ideas.
  • Catalog of bounds: Existing bounds vary by construction, projection, additive, relative, and randomized-error settings, with failure probability reductions generally costing O(log(1/δ)) factors.The catalog parameterizes bounds by n, d, k, rank, ε, and randomized failure probability δ.

6 Experimental Results

The experiments compare Frequent Directions with brute-force, naïve, sampling, hashing, and random-projection methods under a shared sketch-space constraint. Across synthetic and Birds data, Frequent Directions provides strong accuracy and scaling, but its running time is not better than competitors.

  • 6.1 Competing algorithms: Five algorithms are compared using streaming rows, an ℓ×d sketch, and o(ℓd) auxiliary space, except brute force, which uses Θ(d^2) space.The comparison includes brute force, naïve, sampling, hashing, and random-projection.
  • 6.2 Datasets: The synthetic experiments vary signal dimension m and noise ratio η, with covariance and projection error measured across sketch sizes.The default synthetic matrix has size 10,000 × 1,000; projection-error experiments recover rank k = m.
  • 6.3 Results: Random techniques perform worse than naïve on covariance error for small sketches because under-sampling causes overcorrection, whereas Frequent Directions does not show this effect.The three random techniques perform equally well in these experiments, though the authors note this may depend on the chosen input.
  • 6.3 Results: Frequent Directions produces significantly more accurate sketches than predicted by its worst-case analysis, with similar error and runtime patterns also observed on Birds data.Figure 8 reports covariance error, projection error, and running time for the Birds dataset.
  • 6.3 Results: Frequent Directions is not faster than its competitors: hashing is nearly as fast as naïve, sampling is faster, and random-projection is faster by about a factor of 3.The authors caution that the tested implementations were not carefully optimized, so different implementations might produce different results.
  • 6.3 Results: With fixed sketch size ℓ = 100, Frequent Directions runs in O(ndℓ), scales linearly in n and d, and sketches a 10^5 × 10^4 matrix in roughly 3 minutes.Figure 9 varies n and d while measuring only the running time of Algorithm 3.1.
Loading 1501.01711v2…