Description Usage Arguments See Also
View source: R/rlib_multi_util.R
Build additive linear model to predict y from x using elastic net. It fits the use case when the number of predictors is much larger than the number of observations.
1 2 3 4 5 6 7 8 9 | fit_glmnet_with_cv(
x,
y,
nfold = 5,
lambda_seq = NULL,
alpha = 0.5,
n_times = 3,
...
)
|
x |
x (N by P, usually P >> N) |
y |
y (N by 1) |
nfold |
fold in cross-valiation to pick hyperparameter lambda (default = 5) |
lambda_seq |
specify the sequence of hyperparameter lambda to search. If don't have such lambda_seq, set it to NULL, and the function will generate one internally (default = NULL) |
alpha |
alpha parameter in glmnet (defualt = 0.5) |
n_times |
how many rounds of partitions you'd like to perform to estimate CV MSE for each lambda (it is specific for nested CV procedure; default = 3) |
... |
additional arguments passed to cv.glmnet |
do_elastic_net
for details on nested CV procedure.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.