wrapperEvaluator: Wrapper measure generator

Description Usage Arguments Details Value Author(s) References Examples

View source: R/wrapperGenerator.R

Description

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

1
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

\insertAllCited

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## 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)

Example output

Loading required package: lattice
Loading required package: ggplot2
[1] 0.9668664

FSinR documentation built on Nov. 23, 2020, 5:10 p.m.