fit_glmnet_with_cv: Wrapper for fitting elastic net model with nested...

Description Usage Arguments See Also

View source: R/rlib_multi_util.R

Description

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.

Usage

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,
  ...
)

Arguments

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

See Also

do_elastic_net for details on nested CV procedure.


liangyy/mixqtl documentation built on Sept. 17, 2020, 11:36 a.m.