Skip to contents

Ordinary linear regression. Calls stats::lm().

Dictionary

This Learner can be instantiated via the dictionary mlr_learners or with the associated sugar function lrn():

mlr_learners$get("regr.lm")
lrn("regr.lm")

Meta Information

, * Task type: “regr”, * Predict Types: “response”, “se”, * Feature Types: “logical”, “integer”, “numeric”, “factor”, “character”, * Required Packages: mlr3, mlr3learners, 'stats'

Parameters

, |Id |Type |Default |Levels |Range |, |:-----------|:---------|:-------|:----------------------------|:------------------------------------|, |df |numeric |Inf | |\((-\infty, \infty)\) |, |interval |character |- |none, confidence, prediction |- |, |level |numeric |0.95 | |\((-\infty, \infty)\) |, |model |logical |TRUE |TRUE, FALSE |- |, |offset |logical |- |TRUE, FALSE |- |, |pred.var |untyped |- | |- |, |qr |logical |TRUE |TRUE, FALSE |- |, |scale |numeric |NULL | |\((-\infty, \infty)\) |, |singular.ok |logical |TRUE |TRUE, FALSE |- |, |x |logical |FALSE |TRUE, FALSE |- |, |y |logical |FALSE |TRUE, FALSE |- |

Contrasts

To ensure reproducibility, this learner always uses the default contrasts:

Setting the option "contrasts" does not have any effect. Instead, set the respective hyperparameter or use mlr3pipelines to create dummy features.

See also

Other Learner: mlr_learners_classif.cv_glmnet, mlr_learners_classif.glmnet, mlr_learners_classif.kknn, mlr_learners_classif.lda, mlr_learners_classif.log_reg, mlr_learners_classif.multinom, mlr_learners_classif.naive_bayes, mlr_learners_classif.nnet, mlr_learners_classif.qda, mlr_learners_classif.ranger, mlr_learners_classif.svm, mlr_learners_classif.xgboost, mlr_learners_regr.cv_glmnet, mlr_learners_regr.glmnet, mlr_learners_regr.kknn, mlr_learners_regr.km, mlr_learners_regr.ranger, mlr_learners_regr.svm, mlr_learners_regr.xgboost

Super classes

mlr3::Learner -> mlr3::LearnerRegr -> LearnerRegrLM

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method loglik()

Extract the log-likelihood (e.g., via stats::logLik() from the fitted model.

Usage

LearnerRegrLM$loglik()


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerRegrLM$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (requireNamespace("stats", quietly = TRUE)) {
  learner = mlr3::lrn("regr.lm")
  print(learner)

  # available parameters:
learner$param_set$ids()
}
#> <LearnerRegrLM:regr.lm>
#> * Model: -
#> * Parameters: list()
#> * Packages: mlr3, mlr3learners, stats
#> * Predict Type: response
#> * Feature types: logical, integer, numeric, factor, character
#> * Properties: loglik, weights
#>  [1] "df"          "interval"    "level"       "model"       "offset"     
#>  [6] "pred.var"    "qr"          "scale"       "singular.ok" "x"          
#> [11] "y"