update.RAP {rRAP} | R Documentation |
Update sparsity parameter and regression coefficients
Description
Update regularization parameter and the associated Lasso regression coefficients, Updates can either be mini-batch or single observations.
Usage
## S3 method for class 'RAP'
update(object, Ynew, Xnew, ...)
Arguments
object |
Current RAP object |
Ynew |
New response. In the case of mini-batch updates a vector should be provided. |
Xnew |
New covariates. This should be a matrix. |
... |
Additional arguments |
Details
See Monti et al 2016
Value
A RAP objecti is returned where the regularization parameter and the estimated regression coefficients have been updated.
Note
Warning that this implementation uses the shooting algorithm (co-ordinate gradient descent) to update regression coefficients. A more efficient implementation would employ stochastic gradient descent.
Author(s)
Ricardo Pio Monti
References
See Monti et al, "A framework for adaptive regularization in streaming Lasso models", 2016
See Also
Examples
# Recreate Figure 1 from
library(lars)
data(diabetes)
Data = cbind(diabetes$y, diabetes$x)
# initialize RAP object
R = RAP(X = matrix(diabetes$x[1,], nrow=1), y = diabetes$y[1], r = .995, eps = 0.0005, l0 = .1)
# iteratively update:
## Not run:
for (i in 2:nrow(Data)){
R = update.RAP(object=R, Ynew = diabetes$y[i], Xnew=matrix(diabetes$x[i,], nrow=1))
}
## End(Not run)