Using precomputed Gram matrix in sklearn linear models (Lasso, Lars, etc)
(My answer is based on the usage of svm.SVC, Lasso may be different.)
I think that you are supposed pass the Gram matrix instead of X to the fit method.
Also, the Gram matrix has shape (n_samples, n_samples) so it should also be too large for memory in your case, right?
I'm trying to train a linear model on a very large dataset. 
The feature space is small but there are too many samples to hold in memory. 
I'm calculating the Gram matrix on-the-fly and trying to pass it as an argument to sklearn Lasso (or other algorithms) but, when I call fit, it needs the actual X and y matrices. 
Any idea how to use the 'precompute' feature without storing the original matrices?