geneticAlgorithm {FSinR} | R Documentation |
Genetic Algorithm
Description
Generates a search function based on a genetic algorithm. This function is called internally within the searchAlgorithm
function. The geneticAlgorithm method (Yang and Honavar 1998) starts with an initial population of solutions and at each step applies a series of operators to the individuals in order to obtain new and better population of individuals. These operators are selection, crossing and mutation methods. This method uses the GA package implementation (Scrucca 2013) (Scrucca 2017).
Usage
geneticAlgorithm(
popSize = 20,
pcrossover = 0.8,
pmutation = 0.1,
maxiter = 100,
run = 100,
verbose = FALSE
)
Arguments
popSize |
The popuplation size |
pcrossover |
The probability of crossover between individuals |
pmutation |
The probability of mutation between individuals |
maxiter |
The number of iterations |
run |
Number of consecutive iterations without fitness improvement to stop the algorithm |
verbose |
Print the partial results in each iteration. This functionality is not available if the objective of the evaluation method is to minimize the target value (e.g. regression methods) |
Value
Returns a search function that is used to guide the feature selection process.
Author(s)
Francisco Aragón Royón
References
Scrucca L (2013).
“GA: A Package for Genetic Algorithms in R.”
Journal of Statistical Software, 53, 1–37.
https://www.jstatsoft.org/article/view/v053i04.
Scrucca L (2017).
“On some extensions to GA package: hybrid optimisation, parallelisation and islands evolution.”
The R Journal, 9, 187–206.
https://journal.r-project.org/archive/2017/RJ-2017-008/.
Yang J, Honavar V (1998).
“Feature subset selection using a genetic algorithm.”
In Feature extraction, construction and selection, 117–136.
Springer.
Examples
## Not run:
## The direct application of this function is an advanced use that consists of using this
# function directly and performing a search process in a feature space
## Classification problem
# Generates the filter evaluation function
filter_evaluator <- filterEvaluator('determinationCoefficient')
# Generates the search function with Genetic algorithm
ga_search <- geneticAlgorithm()
# Performs the search process directly (parameters: dataset, target variable and evaluator)
ga_search(iris, 'Species', filter_evaluator)
## End(Not run)