Learn R Programming

FSinR (version 2.0.5)

geneticAlgorithm: Genetic Algorithm

Description

Generates a search function based on a genetic algorithm. This function is called internally within the searchAlgorithm function. The geneticAlgorithm method yang1998featureFSinR 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 GAPkg1FSinR GAPkg2FSinR.

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.

References

Examples

Run this code
# 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)
# }

Run the code above in your browser using DataLab