Learn R Programming

caret (version 6.0-24)

rfeControl: Controlling the Feature Selection Algorithms

Description

This function generates a control object that can be used to specify the details of the feature selection algorithms used in this package.

Usage

rfeControl(functions = NULL,
           rerank = FALSE,
           method = "boot",
           saveDetails = FALSE,
           number = ifelse(method %in% c("cv", "repeatedcv"), 10, 25),
           repeats = ifelse(method %in% c("cv", "repeatedcv"), 1, number),
           verbose = FALSE,
           returnResamp = "final",
           p = .75,
           index = NULL,
           timingSamps = 0,
           seeds = NA,
           allowParallel = TRUE)

Arguments

functions
a list of functions for model fitting, prediction and variable importance (see Details below)
rerank
a logical: should variable importance be re-calculated each time features are removed?
method
The external resampling method: boot, cv, LOOCV or LGOCV (for repeated training/test splits
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
saveDetails
a logical to save the predictions and variable importances from the selection process
verbose
a logical to print a log for each external resampling iteration
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
index
a list with elements for each external resampling iteration. Each list element is the sample rows used for training at that iteration.
timingSamps
the number of training set samples that will be used to measure the time for predicting samples (zero indicates that the prediction time should not be estimated).
seeds
an optional set of integers that will be used to set the seed at each resampling iteration. This is useful when the models are run in parallel. A value of NA will stop the seed from being set within the worker processes while a value of
allowParallel
if a parallel backend is loaded and available, should the function use it?

Value

  • A list

itemize

  • y

item

  • x
  • x
  • y
  • metric
  • maximize
  • size

pkg

caret

url

http://caret.r-forge.r-project.org/featureselection.html

Details

More details on this function can be found at http://caret.r-forge.r-project.org/featureselection.html.

Backwards selection requires function to be specified for some operations.

The fit function builds the model based on the current data set. The arguments for the function must be:

  • x
{ the current training set of predictor data with the appropriate subset of variables} y{ the current outcome data (either a numeric or factor vector)} first{ a single logical value for whether the current predictor set has all possible variables} last{ similar to first, but TRUE when the last model is fit with the final subset size and predictors.} ...{optional arguments to pass to the fit function in the call to rfe}

See Also

rfe, lmFuncs, rfFuncs, treebagFuncs, nbFuncs, pickSizeBest, pickSizeTolerance

Examples

Run this code
subsetSizes <- c(2, 4, 6, 8)
set.seed(123)
seeds <- vector(mode = "list", length = 51)
for(i in 1:50) seeds[[i]] <- sample.int(1000, length(subsetSizes) + 1)
seeds[[51]] <- sample.int(1000, 1)

set.seed(1)
rfMod <- rfe(bbbDescr, logBBB,
             sizes = subsetSizes,
             rfeControl = rfeControl(functions = rfFuncs, 
                                     seeds = seeds,
                                     number = 50))

Run the code above in your browser using DataLab