SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1802.05447 · 2018

History PCA: A New Algorithm for Streaming PCA

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1802.05447.json · badge: /api/ran/1802.05447.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
aamcbee/AdaOja community (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
FunctionStatusWhere it lives
get_bagXblocks Ran
ran on a synthesized input
aamcbee/AdaOja/data_strm_subclass.py
code served (permissive licence) · get_code("b6712e8b655958d6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import os

# Create a temporary file with bag of words data in the expected format
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_filename = temp_file.name

# Write a small bag of words dataset
# Format: first line is n (num samples), second is d (num features), third is nnz (num nonzeros)
# Then each line is: row col value (1-indexed)
n_samples = 8
n_features = 5
n_nonzeros = 12

temp_file.write(f"{n_samples}\n")
temp_file.write(f"{n_features}\n")
temp_file.write(f"{n_nonzeros}\n")

# Write nonzero entries (row col value, 1-indexed)
entries = [
    (1, 1, 3),
    (1, 2, 2),
    (2, 3, 1),
    (3, 1, 4),
    (4, 2, 5),
    (4, 4, 2),
    (5, 5, 1),
    (6, 1, 2),
    (7, 3, 3),
    (8, 2, 1),
    (8, 4, 4),
    (8, 5, 2),
]

for row, col, val in entries:
    temp_file.write(f"{row} {col} {val}\n")

temp_file.close()

ARGS = {
    'filename': temp_filename,
    'B': 2,
    'Acc': True,
    'block_total': 1000,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
list_exp_var Ran
ran on a synthesized input
aamcbee/AdaOja/streaming_subclass.py
code served (permissive licence) · get_code("85f93bd361205ced")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import scipy.linalg as la

# Set seed for reproducibility
np.random.seed(0)

# Parameters for list_exp_var
# Xlist: a list of Bxd arrays (blocks of data)
# Create a list of 3 blocks with different batch sizes but same feature dimension
B1, B2, B3, d = 2, 2, 1, 4  # Last block has different first dimension
block1 = np.random.randn(B1, d)
block2 = np.random.randn(B2, d)
block3 = np.random.randn(B3, d)
Xlist = [block1, block2, block3]

# Q: a dense d x k array (projection vectors)
k = 3
Q = np.random.randn(d, k)

# xnorm2: float > 0, the squared frobenius norm of X
# Compute the total squared Frobenius norm of all blocks concatenated
X_total = np.vstack(Xlist)
xnorm2 = float(la.norm(X_total, ord='fro') ** 2)

ARGS = {
    'Xlist': Xlist,
    'Q': Q,
    'xnorm2': xnorm2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
list_mean Ran
ran on a synthesized input
aamcbee/AdaOja/streaming_subclass.py
code served (permissive licence) · get_code("d521582b745e7ae8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a list of numpy arrays with distinct shapes
# Each array has shape (B, d) where B is batch size and d is dimensionality
array1 = np.random.randn(2, 4)  # 2 samples, 4 features
array2 = np.random.randn(3, 4)  # 3 samples, 4 features
array3 = np.random.randn(5, 4)  # 5 samples, 4 features

Xlist = [array1, array2, array3]

ARGS = {
    "Xlist": Xlist
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (4,) — shape (4,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
list_xnorm2 Ran
ran on a synthesized input
aamcbee/AdaOja/streaming_subclass.py
code served (permissive licence) · get_code("f5ebca5bfa1c569a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
import scipy.sparse as sp
import scipy.linalg as la
import scipy.sparse.linalg as spla

torch.manual_seed(0)

# Create a list of sparse matrices (COO format works well with scipy.sparse.linalg)
# First block: 2x4 sparse matrix
X1_dense = np.random.randn(2, 4)
X1_sparse = sp.coo_matrix(X1_dense)

# Second block: 3x4 sparse matrix (different first dimension)
X2_dense = np.random.randn(3, 4)
X2_sparse = sp.coo_matrix(X2_dense)

Xlist_sparse = [X1_sparse, X2_sparse]

# Also create dense versions for testing the Sparse=False case
Xlist_dense = [X1_dense, X2_dense]

ARGS = {
    'Xlist': Xlist_sparse,
    'ord': 'fro',
    'Sparse': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
random_multinomial Ran
ran on a synthesized input
aamcbee/AdaOja/simulated_data.py
code served (permissive licence) · get_code("87b486a516fc367a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import scipy.linalg as la
from scipy.stats import multinomial

ARGS = {
    "n": 5,
    "d": 8,
    "trials": 100,
    "mean0": True,
    "scale": 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
random_multivar_normal Ran
ran on a synthesized input
aamcbee/AdaOja/simulated_data.py
code served (permissive licence) · get_code("74a4d0cc0eaaef64")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import scipy.linalg as la

np.random.seed(0)

ARGS = {
    "n": 5,
    "d": 4,
    "k": 2,
    "sigma": 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
spiked_covariance Ran
ran on a synthesized input
aamcbee/AdaOja/simulated_data.py
code served (permissive licence) · get_code("d505e38a8db19e9e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import scipy.linalg as la

np.random.seed(0)

ARGS = {
    "n": 5,
    "d": 4,
    "k": 2,
    "sigma": 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_bagX Not yet run
unverified (harvested, no recorded run)
aamcbee/AdaOja/data_strm_subclass.py
code served (permissive licence) · get_code("f381eb97725c14b9")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("1802.05447")
get_code_for_paper("1802.05447")
have("1802.05447")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/1802.05447.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/1802.05447.svg)](https://syntology.ai/paper/1802.05447)

Connect an agent — have() is free.