.fit.genetic | R Documentation |
tidyfit
Fits a linear regression with variable selection using a genetic algorithm on a 'tidyFit' R6
class. The function can be used with regress
.
## S3 method for class 'genetic'
.fit(self, data = NULL)
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). |
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.
A fitted tidyFit class model.
Johann Pfitzinger
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.
.fit.lm
, .fit.bayes
and m
methods
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.