Learn R Programming

FSinR (version 2.0.5)

wrapperEvaluator: Wrapper measure generator

Description

Generates a wrapper function to be used as an evaluator kohavi1997FSinR in the feature selection proccess, given a learner algorithm and related customizable parameters caretFSinR. 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.

Value

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

Details

generaWrapper

References

Examples

Run this code
# 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'))
# }

Run the code above in your browser using DataLab