mod_cv_penalized: Fits a GLM penalized model using k-fold cross-validation to...

View source: R/mod_cv_penalized.R

mod_cv_penalizedR Documentation

Fits a GLM penalized model using k-fold cross-validation to tune the alpha and lambda hyperparameters

Description

Fits a GLM penalized model using k-fold cross-validation to tune the alpha and lambda hyperparameters

Usage

mod_cv_penalized(
  data,
  x_names = character(),
  y_name,
  alpha = seq(0, 1, by = 0.2),
  cv_strat = "min",
  n_folds = 10,
  type_measure = "mse"
)

Arguments

data

A numeric dataset in matrix-convertible format

x_names

A character vector of explainatory variables names

y_name

A character naming the variable to explain

alpha

A numeric vector of alpha to use for the cross-validation

cv_strat

A character telling which alpha should be consider optimal "min": minimize the error "1se": selects less variables while allowing a greater error (min + 1se)

n_folds

An integer giving the number of folds tu use in k-folds cv

type_measure

A character naming the error metric used for the cross-validation (defaults to "mse")

Value

The fitted model


cottinlola/modeleVariablesAP documentation built on April 30, 2022, 7:42 a.m.