Learn R Programming

cvms (version 1.7.0)

model_functions: Examples of model_fn functions

Description

lifecycle::badge("experimental")

Examples of model functions that can be used in cross_validate_fn(). They can either be used directly or be starting points.

The update_hyperparameters() function updates the list of hyperparameters with default values for missing hyperparameters. You can also specify required hyperparameters.

Usage

model_functions(name)

Value

A function with the following form:

function(train_data, formula, hyperparameters) {

# Return fitted model object

}

Arguments

name

Name of model to get model function for, as it appears in the following list:

NameFunctionHyperparameters (default)
"lm"stats::lm()
"lmer"lme4::lmer()REML (FALSE)
"glm_binomial"stats::glm()
"glmer_binomial"lme4::glmer()
"svm_gaussian"e1071::svm()kernel ("radial"), cost (1)
"svm_binomial"e1071::svm()kernel ("radial"), cost (1)
"svm_multinomial"e1071::svm()kernel ("radial"), cost (1)
"naive_bayes"e1071::naiveBayes()laplace (0)

Author

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

See Also

Other example functions: predict_functions(), preprocess_functions(), update_hyperparameters()