Description Usage Arguments Value Author(s) References Examples
View source: R/metaheuristic.R
Generates a search function based on a genetic algorithm. This function is called internally within the searchAlgorithm
function. The geneticAlgorithm method \insertCiteyang1998featureFSinR 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 \insertCiteGAPkg1FSinR \insertCiteGAPkg2FSinR.
1 2 3 4 5 6 7 8 | geneticAlgorithm(
popSize = 20,
pcrossover = 0.8,
pmutation = 0.1,
maxiter = 100,
run = 100,
verbose = FALSE
)
|
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) |
Returns a search function that is used to guide the feature selection process.
Francisco Aragón Royón
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.