Description Usage Arguments Details Value
Selects parents based on specified selection mechanism. The possibile selection mechanism includes (1)selecting both parents with probability proportional to ranking, (2)selecting one parent with probability proportional to ranking and one parent randomly, and (3)selecting with method of tournament selection.
1 | selection(pop, fitScores, offspringNum, method = 1, K)
|
pop |
boleans matrix determined by |
fitnessFunction |
fitness function that takes in an lm or glm model and returns a numerical fitness of that model. Users can choose AIC or BIC or even define by themselves. |
model |
the linear model that user wants to use to fit in the data,
can be either |
fitScores |
fitness scores calculated by |
offspringNum |
number of offspring generated to update the generation. |
method |
the selection mechanism that user wants to apply to select parents, can be choosen from 1 to 3; 1 indicates selecting both parents with probability proportional to ranking; 2 indicates selecting one parent with probability proportional to ranking and one parent randomly, and 3 indicates selecting with method of tournament selection. |
dat |
data frame containing the predictors in the model. First column should be the response variable. |
K |
number of groups to partition the population into for tournament selection |
This function selects parents to breed based on the passed in
selection mechanism. Select (offspringNum / 2) pairs of parents from the
passed in population pop, by specific selection mechanism and the fitness
scores fitScores obtained from GA::fitness()
.
Returns a list containing the index for each of parent 1, the index for each of parent 2, the fittest individual, and the fitness scores for the whole population.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.