fitness: Calculate Fitness based on Fitness Function

Description Usage Arguments Value

Description

Calculate the fitness value for each individuals in the generation based on the passed in fitness function.

Usage

1
fitness(pop, dat, fitnessFunction, model)

Arguments

pop

boleans matrix determined by GA::initialization()

y

response variable vector

X

data matrix with rows as observations and columns as predictors in the model.

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 lm or glm.

dat

data frame containing the predictors in the model. First column should be the response variable.

...

additional arguments to pass to regression model

Value

Returns a matrix containing one row with ncol(pop) observations of the fitness scores of each chromosomes.


mindyyang/GA-R-package- documentation built on May 12, 2019, 12:31 a.m.