mlr_learners_classif.gam: Classification Generalized Additive Model Learner

mlr_learners_classif.gamR Documentation

Classification Generalized Additive Model Learner

Description

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

Id Type Default Levels Range
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 -
edge.correct logical FALSE TRUE, FALSE -
nei untyped - -
ncv.threads integer 1 [1, \infty)
block.size integer 1000 (-\infty, \infty)
unconditional logical FALSE TRUE, FALSE -

Super classes

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

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
LearnerClassifGam$new()

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.

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("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


mlr-org/mlr3extralearners documentation built on Nov. 11, 2024, 11:11 a.m.