Skip to contents

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

Multiclass classification is not implemented yet.

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("classif.gam")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

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

  • Required Packages: mlr3, mlr3extralearners, mgcv

Parameters

IdTypeDefaultLevelsRange
formulauntyped--
offsetuntypedNULL-
methodcharacterGCV.CpGCV.Cp, GACV.Cp, REML, P-REML, ML, P-ML-
optimizeruntypedc("outer", "newton")-
scalenumeric0\((-\infty, \infty)\)
selectlogicalFALSETRUE, FALSE-
knotsuntypedNULL-
spuntypedNULL-
min.spuntypedNULL-
HuntypedNULL-
gammanumeric1\([1, \infty)\)
paraPenuntypedNULL-
GuntypedNULL-
in.outuntypedNULL-
drop.unused.levelslogicalTRUETRUE, FALSE-
drop.interceptlogicalFALSETRUE, FALSE-
nthreadsinteger1\([1, \infty)\)
irls.regnumeric0\([0, \infty)\)
epsilonnumeric1e-07\([0, \infty)\)
maxitinteger200\((-\infty, \infty)\)
tracelogicalFALSETRUE, FALSE-
mgcv.tolnumeric1e-07\([0, \infty)\)
mgcv.halfinteger15\([0, \infty)\)
rank.tolnumeric1.490116e-08\([0, \infty)\)
nlmuntypedlist()-
optimuntypedlist()-
newtonuntypedlist()-
outerPIstepsinteger0\([0, \infty)\)
idLinksBaseslogicalTRUETRUE, FALSE-
scalePenaltylogicalTRUETRUE, FALSE-
efs.lspmaxinteger15\([0, \infty)\)
efs.tolnumeric0.1\([0, \infty)\)
scale.estcharacterfletcherfletcher, pearson, deviance-
edge.correctlogicalFALSETRUE, FALSE-
neiuntyped--
ncv.threadsinteger1\([1, \infty)\)
block.sizeinteger1000\((-\infty, \infty)\)
unconditionallogicalFALSETRUE, FALSE-

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.”

Author

pierrecamilleri

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifGam

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerClassifGam$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# simple example
t = mlr3::tsk("spam")$filter(1:1000)
l = mlr3::lrn("classif.gam")
l$param_set$set_values(
  formula = type ~ s(george, k = 3) + s(charDollar, k = 3) + s(edu)
)
l$train(t)
l$model
#> 
#> Family: binomial 
#> Link function: logit 
#> 
#> Formula:
#> type ~ s(george, k = 3) + s(charDollar, k = 3) + s(edu)
#> 
#> Estimated degrees of freedom:
#> 1 1 1  total = 4 
#> 
#> UBRE score: -0.992