Learn R Programming

specmine (version 3.1.6)

recursive_feature_elimination: Perform recursive feature elimination

Description

Perform recursive feature elimination on the dataset using caret's package.

Usage

recursive_feature_elimination(datamat, samples.class, 
functions = caret::rfFuncs, method = "cv", repeats = 5, 
number = 10, subsets = 2^(2:4))

Arguments

datamat

data matrix from dataset.

samples.class

string or index indicating what metadata to use.

functions

a list of functions for model fitting, prediction and variable importance.

method

the external resampling method: boot, cv, LOOCV or LGOCV (for repeated training/test splits.

repeats

for repeated k-fold cross-validation only: the number of complete sets of folds to compute.

number

either the number of folds or number of resampling iterations.

subsets

a numeric vector of integers corresponding to the number of features that should be retained.

Value

A caret's rfe object with the result of recursive feature selection.

Examples

Run this code
# NOT RUN {
  ## Example of recursive feature elimination
  library(specmine.datasets)
  data(cachexia)
  library(caret)
  rfe.result = recursive_feature_elimination(cachexia$data, 
	       cachexia$metadata$Muscle.loss, functions = caret::rfFuncs, 
	       method = "cv", number = 3, subsets = 2^(1:6))
# }

Run the code above in your browser using DataLab