Skip to contents

Setup hyperparameters for GLMNET training.

Usage

setup_GLMNET(
  alpha = 1,
  family = NULL,
  offset = NULL,
  which_lambda_cv = "lambda.1se",
  nlambda = 100L,
  lambda = NULL,
  penalty_factor = NULL,
  standardize = TRUE,
  intercept = TRUE,
  ifw = TRUE
)

Arguments

alpha

(Tunable) Numeric [0, 1]: Elastic net mixing parameter.

family

Optional Character {"gaussian", "binomial", "poisson", "multinomial", "cox", "mgaussian"}: Family. NULL = set from outcome type.

offset

Optional Numeric vector: Offset, one value per case.

which_lambda_cv

Character {"lambda.1se", "lambda.min"}: Which lambda to use for prediction.

nlambda

Integer [1, Inf): Number of lambda values.

lambda

Optional Numeric [0, Inf) vector: Lambda values. NULL = determined by cv.glmnet during tuning.

penalty_factor

Optional Numeric [0, Inf) vector: Penalty factor for each feature.

standardize

Logical: If TRUE, standardize features.

intercept

Logical: If TRUE, include intercept.

ifw

(Tunable) Logical: If TRUE, use Inverse Frequency Weighting in classification.

Value

GLMNETHyperparameters object.

Details

Get more information from glmnet::glmnet.

Author

EDG

Examples

glm_hyperparams <- setup_GLMNET(alpha = 1, ifw = TRUE)
glm_hyperparams
#> <GLMNETHyperparameters>
#>         hyperparameters: 
#>                                    alpha: <nmr> 1.00
#>                                   family: <NUL> NULL
#>                                   offset: <NUL> NULL
#>                          which_lambda_cv: <chr> lambda.1se
#>                                  nlambda: <int> 100
#>                                   lambda: <NUL> NULL
#>                           penalty_factor: <NUL> NULL
#>                              standardize: <lgc> TRUE
#>                                intercept: <lgc> TRUE
#>                                      ifw: <lgc> TRUE
#>                               lambda.min: <NUL> NULL
#>                               lambda.1se: <NUL> NULL
#> tunable_hyperparameters: <chr> alpha, ifw
#>   fixed_hyperparameters: <chr> family, offset, which_lambda_cv, nlambda, lambda, penalty_factor, standardize, intercept, lambda.min, lambda.1se
#>                   tuned: <int> 0
#>               resampled: <int> 0
#>               n_workers: <int> 1
#> 
#>   Hyperparameter lambda needs tuning.