Fits Lasso regression using a customized procedure, with cross-validation based on origami
cv_lasso(x_basis, y, n_lambda = 100, n_folds = 10, center = FALSE)
A dgCMatrix
object corresponding to a sparse matrix of
the basis functions generated for the HAL algorithm.
A numeric
vector of the observed outcome variable values.
A numeric
scalar indicating the number of values of
the L1 regularization parameter (lambda) to be obtained from fitting the
Lasso to the full data. Cross-validation is used to select an optimal
lambda (that minimizes the risk) from among these.
A numeric
scalar for the number of folds to be used in
the cross-validation procedure to select an optimal value of lambda.
binary. If TRUE
, covariates are centered. This is much
slower, but matches the glmnet
implementation. Default FALSE
.