predict_functions: Examples of predict_fn functions

View source: R/predict_functions.R

predict_functionsR Documentation

Examples of predict_fn functions

Description

\Sexpr[results=rd, stage=render]{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)

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.

Name Function Model 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()

Value

A function with the following form:

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

⁠ ⁠# Use model to predict test_data

⁠ ⁠# Return predictions

}

Author(s)

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

See Also

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


cvms documentation built on Sept. 11, 2024, 6:22 p.m.