tournament: Choose parents using tournament selection. Each time,...

Description Usage Arguments Value Examples

Description

Choose parents using tournament selection. Each time, randomly pick k models from the previous generation and the best-performed model will be selected as the parent. Repeat this process until all slots for parents are filled.

Usage

1
tournament(models, k)

Arguments

models

dataframe with models (specified by the index of selected variables) and their respective fitness value. Object returned by ranked_models().

k

size of each round of selection. Must be an integer smaller than generation size.

Value

The selected parents(list of ceiling(nrow(models)/2) lists, each list contains two parents)

Examples

1
2
3
4
5
x <- mtcars[-1]
y <- unlist(mtcars[1])
initial_index <- initialize_parents(10,20)$index
rankedmodels <- ranked_models(initial_index,x,y)
tournament(rankedmodels,k = 2)

kunaljaydesai/GA2 documentation built on May 30, 2019, 2:15 p.m.