wrapperEvaluator {FSinR}R Documentation

Wrapper measure generator

Description

Generates a wrapper function to be used as an evaluator (Kohavi and John 1997) in the feature selection proccess, given a learner algorithm and related customizable parameters (from Jed Wing et al. 2018). More specifically, the result of calling this function is another function that is passed on as a parameter to the featureSelection function. However, you can also run this function directly to generate an evaluation measure.

Usage

wrapperEvaluator(learner, resamplingParams = list(), fittingParams = list())

Arguments

learner

Learner to be used. The models available are the models available in caret: http://topepo.github.io/caret/available-models.html

resamplingParams

Control parameters for evaluating the impact of model tuning parameters. The arguments are the same as those of the caret trainControl function. By default an empty list. In this case the default caret values are used for resampling and fitting.

fittingParams

Control parameters for choose the best model across the parameters. The arguments are the same as those of the caret train function (minus the parameters: x, y, form, data, method and trainControl). By default an empty list. In this case the default caret values are used for resampling and fitting.

Details

generaWrapper

Value

Returns a wrapper function that is used to generate an evaluation measure

Author(s)

Alfonso Jiménez-Vílchez

Francisco Aragón Royón

References

Kohavi R, John GH (1997). “Wrappers for feature subset selection.” Artificial intelligence, 97, 273–324.

from Jed Wing MKC, Weston S, Williams A, Keefer C, Engelhardt A, Cooper T, Mayer Z, Kenkel B, the R Core Team, Benesty M, Lescarbeau R, Ziem A, Scrucca L, Tang Y, Candan C, Hunt. T (2018). caret: Classification and Regression Training. R package version 6.0-80, https://CRAN.R-project.org/package=caret.

Examples

## Not run:  

## Examples of a wrapper evaluator generation

wrapper_evaluator_1 <- wrapperEvaluator('knn')
wrapper_evaluator_2 <- wrapperEvaluator('mlp')
wrapper_evaluator_3 <- wrapperEvaluator('randomForest')


## Examples of a wrapper evaluator generation (with parameters)

# Values for the caret trainControl function (resampling parameters)
resamplingParams <- list(method = "repeatedcv", repeats = 3)
# Values for the caret train function (fitting parameters)
fittingParams <- list(preProc = c("center", "scale"), metric="Accuracy",
                      tuneGrid = expand.grid(k = c(1:12)))
                      
wrapper_evaluator <- wrapperEvaluator('knn', resamplingParams, fittingParams)


## The direct application of this function is an advanced use that consists of using this 
# function directly to evaluate a set of features
## Classification problem

# Generates the wrapper evaluation function
wrapper_evaluator <- wrapperEvaluator('knn')
# Evaluates features directly (parameters: dataset, target variable and features)
wrapper_evaluator(iris,'Species',c('Sepal.Length','Sepal.Width','Petal.Length','Petal.Width'))

## End(Not run)

[Package FSinR version 2.0.5 Index]