predict_functions function

Examples of predict_fn functions

Examples of predict_fn functions

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.

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.

    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()

Returns

A function with the following form:

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

``# Use model to predict test_data

``# Return predictions

}

See Also

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

Author(s)

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

  • Maintainer: Ludvig Renbo Olsen
  • License: MIT + file LICENSE
  • Last published: 2025-03-07