XTXXTyXTX/nXTy/n
を書く場合Xy as :
X=⎛⎝⎜⎜xT1⋮xTn⎞⎠⎟⎟,y=⎛⎝⎜⎜y1⋮yn⎞⎠⎟⎟,
we can write the online updates to XTX/n and XTy/n (calculated up to the t-th row) as:
At=(1−1t)At−1+1txtxTt,
bt=(1−1t)bt−1+1txtyt.
Your online estimate of β then becomes
β^t=(At+λI)−1bt.
Note that this also helps with the interpretation of λ remaining constant as you add observations!
This procedure is how https://github.com/joshday/OnlineStats.jl computes online estimates of linear/ridge regression.