mlr_learners_regr.gam: Regression Generalized Additive Model Learner

mlr_learners_regr.gamR Documentation

Regression Generalized Additive Model Learner

Description

Generalized additive models. Calls mgcv::gam() from package mgcv.

Formula

A gam formula specific to the task at hand is required for the formula parameter (see example and ?mgcv::formula.gam). Beware, if no formula is provided, a fallback formula is used that will make the gam behave like a glm (this behavior is required for the unit tests). Only features specified in the formula will be used, superseding columns with col_roles "feature" in the task.

Dictionary

This Learner can be instantiated via lrn():

lrn("regr.gam")

Meta Information

  • Task type: “regr”

  • Predict Types: “response”, “se”

  • Feature Types: “logical”, “integer”, “numeric”, “factor”

  • Required Packages: mlr3, mlr3extralearners, mgcv

Parameters

Id Type Default Levels Range
family character gaussian gaussian, poisson -
formula untyped - -
offset untyped NULL -
method character GCV.Cp GCV.Cp, GACV.Cp, REML, P-REML, ML, P-ML -
optimizer untyped c("outer", "newton") -
scale numeric 0 (-\infty, \infty)
select logical FALSE TRUE, FALSE -
knots untyped NULL -
sp untyped NULL -
min.sp untyped NULL -
H untyped NULL -
gamma numeric 1 [1, \infty)
paraPen untyped NULL -
G untyped NULL -
in.out untyped NULL -
drop.unused.levels logical TRUE TRUE, FALSE -
drop.intercept logical FALSE TRUE, FALSE -
nthreads integer 1 [1, \infty)
irls.reg numeric 0 [0, \infty)
epsilon numeric 1e-07 [0, \infty)
maxit integer 200 (-\infty, \infty)
trace logical FALSE TRUE, FALSE -
mgcv.tol numeric 1e-07 [0, \infty)
mgcv.half integer 15 [0, \infty)
rank.tol numeric 1.490116e-08 [0, \infty)
nlm untyped list() -
optim untyped list() -
newton untyped list() -
outerPIsteps integer 0 [0, \infty)
idLinksBases logical TRUE TRUE, FALSE -
scalePenalty logical TRUE TRUE, FALSE -
efs.lspmax integer 15 [0, \infty)
efs.tol numeric 0.1 [0, \infty)
scale.est character fletcher fletcher, pearson, deviance -
nei untyped - -
ncv.threads integer 1 [1, \infty)
edge.correct logical FALSE TRUE, FALSE -
block.size integer 1000 (-\infty, \infty)
unconditional logical FALSE TRUE, FALSE -

Super classes

mlr3::Learner -> mlr3::LearnerRegr -> LearnerRegrGam

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
LearnerRegrGam$new()

Method clone()

The objects of this class are cloneable with this method.

Usage
LearnerRegrGam$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

pierrecamilleri

References

Hastie, J T, Tibshirani, J R (2017). Generalized additive models. Routledge.

Wood, Simon (2012). “mgcv: Mixed GAM Computation Vehicle with GCV/AIC/REML smoothness estimation.”

Examples


# simple example
t = mlr3::tsk("mtcars")
l = mlr3::lrn("regr.gam")
l$param_set$values$formula = mpg ~ cyl + am + s(disp) + s(hp)
l$train(t)
l$model


mlr-org/mlr3extralearners documentation built on Dec. 21, 2024, 2:21 p.m.