
Last chance! 50% off unlimited learning
Sale ends in
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.
geneticAlgorithm(
popSize = 20,
pcrossover = 0.8,
pmutation = 0.1,
maxiter = 100,
run = 100,
verbose = FALSE
)
The popuplation size
The probability of crossover between individuals
The probability of mutation between individuals
The number of iterations
Number of consecutive iterations without fitness improvement to stop the algorithm
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.
# 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