ph_ctrl {pheble}R Documentation

Parameters for resampling and training a dataset.

Description

The ph_ctrl function automatically generates a trControl object. This can be used in the train function to automatically tune hyperparameters for every classification model in the ensemble.

Usage

ph_ctrl(
  class,
  resample_method = "boot",
  number = ifelse(grepl("cv", resample_method, ignore.case = TRUE), 10, 25),
  repeats = ifelse(grepl("dcv$", resample_method, ignore.case = TRUE), 3, NA),
  search = "random",
  sampling = NULL
)

Arguments

class

A factor value for training data classes.

resample_method

A character value for the resampling training method: "boot" (default), "cv", LOOCV", "repeatedcv".

number

An integer value for the number of resampling iterations (25 default for boot) or folds (10 default for cross-validation).

repeats

An integer value for the number of sets of folds for repeated cross-validation.

search

A character value for the hyperparameter search strategy: "random" (default), "grid".

sampling

A character value for the sampling strategy, sometimes used to fix class imbalances: NULL (default), "up", "down", "smote".

Value

A trainControl object for the train function.

Examples

## Import data.
data(ph_crocs)
## Echo control object for train function.
ctrl <- ph_ctrl(ph_crocs$Species, resample_method = "boot")

[Package pheble version 0.1.0 Index]