Description Usage Arguments Details
This is main call function to run package GA. This package is comprised of a main execution file (select.R and a R file comtaining all functions that are necessary for execution (utils.R). The user can enter in a dataset and provide variables (listed below) to execute the genetic algorithm.
1 2 |
df |
(data frame) Dataset to fit |
P |
(int) The number of individuals per generation. |
max_iter |
(int) The maximum number of iterations allowed when running GA |
method_text |
lm() or glm() methods for fitting the data |
fitness_function_text |
AIC, BIC, ow |
random |
(logical) Random replacement on or off for parent selection |
Gap |
Generation gap that determines how parents (generation t) are replaced by offspring of the (t+1) generation |
plot.return |
(logical) Boolean for returning plot at end of the algorithm |
mu: |
Mutation rate of the for each allele within the a given candidate chromosome. |
crossover_points: |
(int) The number of crossover points during breeding step |
mechanism: |
The mechanism to selection parents by. Selection mechanisms are "ranked" or "tournament." |
Contained in the list below are the invdividual functions that are called during the execution of the genetic algorithm.
init(): Initializes the dataframe for the dataset
training(): fits the method on candidates and return the fitness value of the candidate
select_parents(): Chooses parents for breeding based off of ranked or tournament selection using the fitness values of each parent
breed(): Breeds parents based off of pairing from select_parents()
crossover(): Function within breed() to conduct crossover between parent pairs during breeding step
mutation(): Determines if alleles of offspring (t+1 generation) mutates or not
get_model(): Returns the best fit model of the dataset
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.