I'm trying to do a normalized sum of outer product of a 60000x100 matrix. I would like to do it using numpy way, since my solution is constrained by the python for loop in the list comprehension:
def covariance_over_time(X):
B = np.sum(np.array([np.outer(x, x) for x in X]),axis=0)
B = np.true_divide(B, len(X))
return B
Beware that, even this solution works, it's monothread, and therefore very slow when X has 60000 rows and 100 columns.
I have tried other approaches, like descripted here on stackoverflow. The answer posted in the link, works for small matrices, gives me memory after a few seconds error. Do you know why? (Note: I have 6 TeraByte of RAM, so it's very unlikely that I have a memory problem, since I don't see the memory usage growing at all!)