Numpy has a handy least squares estimate of the form np.linalg.lstsq(X, Y) to estimate beta such that X_i * beta = Y_i, where X_i is an m x n matrix, beta is a length-n row vector, and Y is a length-n column vector.
However, what if I want to repeatedly estimate beta as I add rows to X and values to Y? In other words, I first estimate beta with only a single (x,y) pair, then I estimate beta using two (x,y) pairs, then I estimate beta using three (x,y) pairs, etc. I might do this in an online learning setting, for example.
Repeated calls to np.linalg.lstsq(X, Y), on repeatedly updated X and Y, will work but make no use of previous computations. This seems wasteful.
Is there some better way?
Aucun commentaire:
Enregistrer un commentaire