# trainControl

0th

Percentile

##### Control parameters for train

Control the computational nuances of the train function

Keywords
utilities
##### Usage
trainControl(method = "boot",
number = ifelse(method %in% c("cv", "repeatedcv"), 10, 25),
repeats = ifelse(method %in% c("cv", "repeatedcv"), 1, number),
verboseIter = TRUE,
returnData = TRUE,
returnResamp = "final",
p = 0.75,
classProbs = FALSE,
summaryFunction = defaultSummary,
selectionFunction = "best",
PCAthresh = 0.95,
ICAcomp = 3,
k = 5,
index = NULL,
workers = 1,
predictionBounds = rep(FALSE, 2),
computeFunction = lapply,
computeArgs = NULL)
##### Arguments
method
The resampling method: boot, boot632, cv, repeatedcv, LOOCV, LGOCV (for repeated training/test splits), or oob (only for random forest, bagged trees, bagge
number
Either the number of folds or number of resampling iterations
repeats
For repeated k-fold cross-validation only: the number of complete sets of folds to compute
verboseIter
A logical for printing a training log.
returnData
A logical for saving the data
returnResamp
A character string indicating how much of the resampled summary metrics should be saved. Values can be final'', all'' or none''
p
For leave-group out cross-validation: the training percentage
classProbs
a logical; should class probabilities be computed for classification models (along with predicted values) in each resample?
summaryFunction
a function to compute performance metrics across resamples. The arguments to the function should be the same as those in defaultSummary.
selectionFunction
the function used to select the optimal tuning parameter. This can be a name of the function or the function itself. See best for details and other options.
PCAthresh
When invoking train with the preProcess = "pca" option, this parameter allows the user to determine how many PCA components should be kept on the basis of the cumulative amount of variance explai
ICAcomp
When invoking train with the preProcess = "ica" option, this parameter allows the user to determine how many ICA components should be kept. See preProcess
k
When invoking train with the preProcess = "knnImpute" option, this parameter allows the user to determine how many neighbors should be used for imputation. See
index
a list with elements for each resampling iteration. Each list element is the sample rows used for training at that iteration.
workers
an integer that specifies how many machines/processors will be used
predictionBounds
a logical or numeric vector of length 2 (regression only). If logical, the predictions can be constrained to be within the limit of the training set outcomes. For example, a value of c(TRUE, FALSE) would only constrain the lower end of predic
computeFunction
a function that is lapply or emulates lapply. It must have arguments X, FUN and .... computeFunction can be used to build models in parall
computeArgs
Extra arguments to pass into the ... slot in computeFunction. See the examples in train.
##### Value

• An echo of the parameters specified

##### Aliases
• trainControl
Documentation reproduced from package caret, version 4.87, License: GPL-2

### Community examples

RAVINDARMADISHETTY@GMAIL.COM at Jul 23, 2018 caret v6.0-80

I am getting below error while submitting a text x = trainControl(method = "repeatedcv", number = numbers, repeats = repeats, classProbs = TRUE, summaryFunction = twoClassSummary) Error: Please suggesrt Error in trainControl(method = "repeatedcv", number = numbers, repeats = repeats, : could not find function "trainControl"