This learner provides faster procedures for fitting linear and generalized linear models than Lrnr_glm with a minimal memory footprint. This learner uses the internal fitting function provided by speedglm package, speedglm.wfit. See Enea (2009) for more detail. The glm.fit function is used as a fallback, if speedglm.wfit fails.

Format

An R6Class object inheriting from Lrnr_base.

Value

A learner object inheriting from Lrnr_base with methods for training and prediction. For a full list of learner functionality, see the complete documentation of Lrnr_base.

Parameters

  • intercept = TRUE: Should an intercept be included in the model?

  • method = "Cholesky": The method to check for singularity.

  • ...: Other parameters to be passed to speedglm.wfit.

References

Enea M (2009). “Fitting linear models and generalized linear models with large data sets in R.” Statistical Methods for the Analysis of Large Datasets: book of short papers, 411--414.

Examples

data(cpp_imputed)
covs <- c("apgar1", "apgar5", "parity", "gagebrth", "mage", "meducyrs")
task <- sl3_Task$new(cpp_imputed, covariates = covs, outcome = "haz")

# simple, main-terms GLM
lrnr_glm_fast <- Lrnr_glm_fast$new(method = "eigen")
glm_fast_fit <- lrnr_glm_fast$train(task)
glm_fast_preds <- glm_fast_fit$predict()