f_train_lasso_manual_cv: wrapper for glmnet and HDtweedie

Description Usage Arguments Details Value See Also Examples

Description

performs lasso for different distributions, returns a list of formulas that result in the lowest rtmse for at least one of the distributions. Graphical output allows side-by-side comparison of lasso behaviour for all distributions.

Usage

1
2
f_train_lasso_manual_cv(data, formula, grid = 10^seq(4, -4, length =
  100), p = c(1, 1.25, 1.5, 1.75, 2), k = 5, family = "gaussian")

Arguments

data

dataframe

formula

formula

grid

grid values for lambda, Default: 10^seq(4, -4, length = 100)

p

p parameter for tweedie distributions, set p = NULL for not performing lasso for tweedie distributions, Default: c(1, 1.25, 1.5, 1.75, 2)

k

fold cross validation, set to 1 for testing against training data, Default: 5

family

family parameter for glmnet, can be a vector, Default: 'gaussian'

Details

Columns containing NA will be removed, formula cannot be constructed with '.'

Value

list()

See Also

HDtweedie glmnet pipelearner,learn_models,learn_cvpairs,learn

Examples

1
2
3
4
5
6
7
8
9
data = MASS::quine
formula = Days~.

lasso = f_train_lasso(data, formula, p = NULL, k = 1
                     , grid = 10^seq(3,-3,length= 25) )
lasso = f_train_lasso(data, formula, p = 1.5, k = 2
                     , grid = 10^seq(3,-3,length= 25) )

lasso

erblast/oetteR documentation built on May 27, 2019, 12:11 p.m.