Learn R Programming

cvms (version 1.7.0)

predict_functions: Examples of predict_fn functions

Description

lifecycle::badge("experimental")

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

Usage

predict_functions(name)

Value

A function with the following form:

function(test_data, model, formula, hyperparameters, train_data) {

# Use model to predict test_data

# Return predictions

}

Arguments

name

Name of model to get predict function for, as it appears in the following table.

The Model HParams column lists hyperparameters used in the respective model function.

NameFunctionModel HParams
"lm"stats::lm()
"lmer"lme4::lmer()
"glm_binomial"stats::glm()family = "binomial"
"glmer_binomial"lme4::glmer()family = "binomial"
"svm_gaussian"e1071::svm()type = "eps-regression"
"svm_binomial"e1071::svm()type = "C-classification", probability = TRUE
"svm_multinomial"e1071::svm()type = "C-classification", probability = TRUE
"naive_bayes"e1071::naiveBayes()
"nnet_multinom"nnet::multinom()
"nnet_gaussian"nnet::nnet()linout = TRUE
"nnet_binomial"nnet::nnet()
"randomForest_gaussian"randomForest::randomForest()
"randomForest_binomial"randomForest::randomForest()
"randomForest_multinomial"randomForest::randomForest()

Author

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

See Also

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