| TrainFunction {D2MCS} | R Documentation |
Control parameters for train stage.
Description
Abstract class used as template to define customized functions to control the computational nuances of train function.
Methods
Public methods
Method new()
Function used to initialize the object parameters during execution time.
Usage
TrainFunction$new( method, number, savePredictions, classProbs, allowParallel, verboseIter, seed )
Arguments
methodThe resampling method: "boot", "boot632", "optimism_boot", "boot_all", "cv", "repeatedcv", "LOOCV", "LGOCV" (for repeated training/test splits), "none" (only fits one model to the entire training set), "oob" (only for random forest, bagged trees, bagged earth, bagged flexible discriminant analysis, or conditional tree forest models), timeslice, "adaptive_cv", "adaptive_boot" or "adaptive_LGOCV"
numberEither the number of folds or number of resampling iterations
savePredictionsAn indicator of how much of the hold-out predictions for each resample should be saved. Values can be either "all", "final", or "none". A logical value can also be used that convert to "all" (for true) or "none" (for false). "final" saves the predictions for the optimal tuning parameters.
classProbsA logical value. Should class probabilities be computed for classification models (along with predicted values) in each resample?
allowParallelA logical value. If a parallel backend is loaded and available, should the function use it?
verboseIterA logical for printing a training log.
seedAn optional integer that will be used to set the seed during model training stage.
Method create()
Creates a trainControl requires for the
training stage.
Usage
TrainFunction$create(summaryFunction, search.method = "grid", class.probs)
Arguments
summaryFunctionAn object inherited from
SummaryFunctionclass.search.methodEither "grid" or "random", describing how the tuning parameter grid is determined.
class.probsA logical indicating if class probabilities should be computed for classification models (along with predicted values) in each resample.
Method getResamplingMethod()
Returns the resampling method used during training staged.
Usage
TrainFunction$getResamplingMethod()
Returns
A character vector or length 1 or NULL if not defined.
Method getNumberFolds()
Returns the number or folds or number of iterations used during training.
Usage
TrainFunction$getNumberFolds()
Returns
An integer vector or length 1 or NULL if not defined.
Method getSavePredictions()
Indicates if the predictions for each resample should be saved.
Usage
TrainFunction$getSavePredictions()
Returns
A logical value or NULL if not defined.
Method getClassProbs()
Indicates if class probabilities should be computed for classification models in each resample.
Usage
TrainFunction$getClassProbs()
Returns
A logical value.
Method getAllowParallel()
Determines if model training is performed in parallel.
Usage
TrainFunction$getAllowParallel()
Returns
A logical value. TRUE indicates parallelization is enabled and FALSE otherwise.
Method getVerboseIter()
Determines if training log should be printed.
Usage
TrainFunction$getVerboseIter()
Returns
A logical value. TRUE indicates training log is enabled and FALSE otherwise.
Method getTrFunction()
Function used to return the
trainControl object.
Usage
TrainFunction$getTrFunction()
Returns
A trainControl object.
Method getMeasures()
Returns the measures used to optimize model hyperparameters.
Usage
TrainFunction$getMeasures()
Returns
A character vector.
Method getType()
Obtains the type of classification problem ("Bi-class" or "Multi-class").
Usage
TrainFunction$getType()
Returns
A character vector with length 1. Either "Bi-class" or "Multi-class".
Method getSeed()
Indicates seed used during model training stage.
Usage
TrainFunction$getSeed()
Returns
An integer value or NULL if not defined.
Method setSummaryFunction()
Function used to change the SummaryFunction
used in the training stage.
Usage
TrainFunction$setSummaryFunction(summaryFunction)
Arguments
summaryFunctionAn object inherited from
SummaryFunctionclass.
Method setClassProbs()
The function allows changing the class computation capabilities.
Usage
TrainFunction$setClassProbs(class.probs)
Arguments
class.probsA logical indicating if class probabilities should be computed for classification models (along with predicted values) in each resample
Method clone()
The objects of this class are cloneable with this method.
Usage
TrainFunction$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.