Learn R Programming

FSinR (version 1.0.8)

wrapperGenerator: Wrapper measure generator

Description

Generates a wrapper function to be used as an evaluator kohavi1997FSinR, given a learner algorithm and related customizable parameters caretFSinR. More specifically, the result of calling this function is another function that is used as an evaluator in the search methods, although you can also call it up to generate an evaluation measure individually.

Usage

wrapperGenerator(learner, resamplingParams, fittingParams)

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

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).

Value

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

Details

generaWrapper

References

Examples

Run this code
# NOT RUN {
# Values for the caret trainControl function
resamplingParams <- list(method = "repeatedcv", repeats = 3)
# Values for the caret train function
fittingParams <- list(preProc = c("center", "scale"), metric="Accuracy", 
                      tuneGrid = expand.grid(k = c(1:20)))
# Generation of the wrapper function
wrapper <- wrapperGenerator("knn", resamplingParams, fittingParams)
# The function call generates the evaluation measure
wrapper(iris, 'Species', c('Sepal.Length', 'Sepal.Width', 'Petal.Length'))
# }

Run the code above in your browser using DataLab