Abstract
In this paper we propose a new algorithm for streaming principal component analysis. With limited memory, small devices cannot store all the samples in the high-dimensional regime. Streaming principal component analysis aims to find the $k$-dimensional subspace which can explain the most variation of the $d$-dimensional data points that come into memory sequentially. In order to deal with large $d$ and large $N$ (number of samples), most streaming PCA algorithms update the current model using only the incoming sample and then dump the information right away to save memory. However the information contained in previously streamed data could be useful. Motivated by this idea, we develop a new streaming PCA algorithm called History PCA that achieves this goal. By using $O(Bd)$ memory with $B\approx 10$ being the block size, our algorithm converges much faster than existing streaming PCA algorithms. By changing the number of inner iterations, the memory usage can be further reduced to $O(d)$ while maintaining a comparable convergence speed. We provide theoretical guarantees for the convergence of our algorithm along with the rate of convergence. We also demonstrate on synthetic and real world data sets that our algorithm compares favorably with other state-of-the-art streaming PCA methods in terms of the convergence speed and performance.
Introduction
Principal Component Analysis (PCA) is a foundational tool for dimensionality reduction and feature extraction. However, computing the exact PCA requires loading the entire dataset into memory to form a covariance matrix. For massive, high-dimensional datasets, this is impossible on standard hardware.
To solve this, researchers use streaming PCA algorithms, such as Oja's algorithm, which process data sequentially—updating the model one sample or block at a time and immediately discarding the data to save RAM. Unfortunately, existing streaming methods often suffer from slow convergence because they discard valuable past information. Furthermore, popular methods like Oja's require tuning a learning rate (step size), which is notoriously difficult to optimize on the fly. We propose History PCA, a fast, memory-efficient, and hyperparameter-free streaming PCA algorithm that leverages historical data summaries.
The History PCA Algorithm
History PCA cleverly summarizes past data rather than discarding it entirely. Instead of just using the current block of data (of size $B$) to update the eigenvectors, History PCA builds a covariance estimator that combines the current block's sample covariance with a rank-$k$ summary of all past data.
Update Mechanism and Efficiency
At each step $\tau$, the algorithm weights the new block's covariance by $1/\tau$ and the historical summary (the eigenvectors and eigenvalues from step $\tau-1$) by $(\tau-1)/\tau$. It then runs $m$ inner iterations (power iterations or QR decompositions) on this combined estimator to approximate the new top-$k$ eigenvectors.
As shown in Figure 1, History PCA is robust to the choice of inner iterations. By keeping $m$ small (e.g., $m=3$), the algorithm remains computationally cheap while maintaining a minimal memory footprint of $O(Bd)$. This can even be reduced to $O(kd)$ if $m=1$, making it highly scalable for high-dimensional regimes.
Experimental Results
We evaluated History PCA on synthetic data and large-scale real-world datasets including NIPS, NYTimes, RCV1, and the massive KDDB dataset (19.2 million samples).
Performance Comparison
History PCA consistently outperforms state-of-the-art streaming algorithms such as Oja's, Oja++, the block stochastic power method, and DBPCA across all tested scenarios.
As illustrated in Figure 2, History PCA achieves a much lower error rate early in the streaming process. On the KDDB dataset, it achieves an impressive error bound of $10^{-6}$ in just a single pass over the data. In terms of wall-clock time and early-pass error, History PCA even competes favorably with heavy-duty batch algorithms like VR-PCA.
Conclusion
History PCA provides a robust and efficient solution for streaming PCA by utilizing historical summaries to guide model updates. It eliminates the need for complex hyperparameter tuning and matches optimal theoretical convergence rates of $O(1/n)$. While variance-reduced batch methods may eventually surpass it after many passes, History PCA remains the superior choice for high-speed, single-pass, or limited-memory environments.
Summary updated