Learn R Programming

caret (version 6.0-94)

gafs_initial: Ancillary genetic algorithm functions

Description

Built-in functions related to genetic algorithms

These functions are used with the functions argument of the gafsControl function. More information on the details of these functions are at http://topepo.github.io/caret/feature-selection-using-genetic-algorithms.html.

Most of the gafs_* functions are based on those from the GA package by Luca Scrucca. These functions here are small re-writes to work outside of the GA package.

The objects caretGA, rfGA and treebagGA are example lists that can be used with the functions argument of gafsControl.

In the case of caretGA, the ... structure of gafs passes through to the model fitting routine. As a consequence, the train function can easily be accessed by passing important arguments belonging to train to gafs. See the examples below. By default, using caretGA will used the resampled performance estimates produced by train as the internal estimate of fitness.

For rfGA and treebagGA, the randomForest and bagging functions are used directly (i.e. train is not used). Arguments to either of these functions can also be passed to them though the gafs call (see examples below). For these two functions, the internal fitness is estimated using the out-of-bag estimates naturally produced by those functions. While faster, this limits the user to accuracy or Kappa (for classification) and RMSE and R-squared (for regression).

Usage

gafs_initial(vars, popSize, ...)

gafs_lrSelection(population, fitness, r = NULL, q = NULL, ...)

gafs_spCrossover(population, fitness, parents, ...)

gafs_raMutation(population, parent, ...)

gafs_nlrSelection(population, fitness, q = 0.25, ...)

gafs_rwSelection(population, fitness, ...)

gafs_tourSelection(population, fitness, k = 3, ...)

gafs_uCrossover(population, parents, ...)

Value

The return value depends on the function.

Arguments

vars

number of possible predictors

popSize

the population size passed into gafs

...

not currently used

population

a binary matrix of the current subsets with predictors in columns and individuals in rows

fitness

a vector of fitness values

r, q, k

tuning parameters for the specific selection operator

parent, parents

integer(s) for which chromosomes are altered

Author

Luca Scrucca, gafs_initial, caretGA, rfGA and treebagGA by Max Kuhn

References

Scrucca L (2013). GA: A Package for Genetic Algorithms in R. Journal of Statistical Software, 53(4), 1-37.

https://cran.r-project.org/package=GA

http://topepo.github.io/caret/feature-selection-using-genetic-algorithms.html

See Also

gafs, gafsControl