Skip to content

Instantly share code, notes, and snippets.

@BenoitDamota
BenoitDamota / light_pca.py
Last active December 10, 2015 00:39
LightPCA : PCA with little memory footprint.
"""
LightPCA : PCA with little memory footprint, but can only fit_transform()
the data (no transform(), no inverse_transform()).
targeted data (be sure to have at least 5-6GB of free memory):
>>> import numpy as np
>>> from light_pca import LightPCA
>>> X = np.random.randn(1301, 500000) # ~5GB
>>> pca = LightPCA(copy=False, n_components=1300)
>>> X = pca.fit_transform(X)
"""