Fit elastic net, LASSO or ridge regression model

Share:

Description

Using the glmnet package implementation.

Usage

1
2
3
4
5
fit_glmnet(x, y, family, nfolds, foldid, alpha = 1, lambda = NULL, ...)

fit_ridge_regression(...)

fit_lasso(...)

Arguments

x

Dataset.

y

Response vector. Can be of many different types for solving different problems, see glmnet.

family

Determines the the type of problem to solve. Auto detected if y is numeric or survival. See family for details.

nfolds

See cv.glmnet.

foldid

See cv.glmnet.

alpha

Regularization parameter, see glmnet.

lambda

Regularization parameter, see glmnet.

...

Sent to fit_glmnet or cv.glmnet.

Details

The alpha parameter of glmnet controls the type of penalty. Use 0 (default) for lasso only, 1 for ridge only, or an intermediate for a combination. This is typically the parameter to tune on. The shrinkage, controlled by the lambda parameter, can be left unspecified for internal tuning (works the same way as fit_glmnet).

Value

Fitted elastic net model.

Author(s)

Christofer B├Ącklin

See Also

emil, predict_glmnet, importance_glmnet, modeling_procedure

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.