dot-fit.genetic: Genetic algorithm with linear regression fitness evaluator...

.fit.geneticR Documentation

Genetic algorithm with linear regression fitness evaluator for tidyfit

Description

Fits a linear regression with variable selection using a genetic algorithm on a 'tidyFit' R6 class. The function can be used with regress.

Usage

## S3 method for class 'genetic'
.fit(self, data = NULL)

Arguments

self

a tidyFit R6 class.

data

a data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).

Details

Hyperparameters:

None. Cross validation not applicable.

Important method arguments (passed to m)

  • statistic

  • populationSize

  • numGenerations

  • minVariables

  • maxVariables

The function provides a wrapper for gaselect::genAlg. See ?genAlg for more details.

Implementation

Control arguments are passed to gaselect::genAlgControl (the function automatically identifies which arguments are for the control object, and which for gaselect::genAlg).

gaselect::evaluatorLM is used as the evaluator with the relevant arguments automatically identified by the function.

Value

A fitted tidyFit class model.

Author(s)

Johann Pfitzinger

References

Kepplinger D (2023). gaselect: Genetic Algorithm (GA) for Variable Selection from High-Dimensional Data. R package version 1.0.21, https://CRAN.R-project.org/package=gaselect.

See Also

.fit.lm, .fit.bayes and m methods

Examples

# Load data
data <- tidyfit::Factor_Industry_Returns

# Generally used inside 'regress' function
fit <- regress(data, Return ~ ., m("genetic", statistic = "BIC"),
               .mask = c("Date", "Industry"))
coef(fit)


tidyfit documentation built on April 4, 2025, 4:38 a.m.