SLEnsemble_cfg is a configuration class for estimation of a model using an ensemble of models using SuperLearner.

Super class

tidyhte::Model_cfg -> SLEnsemble_cfg

Public fields

cvControl

A list of parameters for controlling the cross-validation used in SuperLearner.

SL.library

A vector of the names of learners to include in the SuperLearner ensemble.

SL.env

An environment containing all of the programmatically generated learners to be included in the SuperLearner ensemble.

family

stats::family object to determine how SuperLearner should be fitted.

model_class

The class of the model, required for all classes which inherit from Model_cfg.

Methods


Method new()

Create a new SLEnsemble_cfg object with specified settings.

Usage

SLEnsemble_cfg$new(
  cvControl = NULL,
  learner_cfgs = NULL,
  family = stats::gaussian()
)

Arguments

cvControl

A list of parameters for controlling the cross-validation used in SuperLearner. For more details, see SuperLearner::SuperLearner.CV.control.

learner_cfgs

A list of SLLearner_cfg objects.

family

stats::family object to determine how SuperLearner should be fitted.

Returns

A new SLEnsemble_cfg object.

Examples

SLEnsemble_cfg$new(
learner_cfgs = list(SLLearner_cfg$new("SL.glm"), SLLearner_cfg$new("SL.gam"))
)


Method add_sublearner()

Adds a model (or class of models) to the SuperLearner ensemble. If hyperparameter values are specified, this method will add a learner for every element in the cross-product of provided hyperparameter values.

Usage

SLEnsemble_cfg$add_sublearner(learner_name, hps = NULL)

Arguments

learner_name

Possible values use SuperLearner naming conventions. A full list is available with SuperLearner::listWrappers("SL")

hps

A named list of hyper-parameters. Every element of the cross-product of these hyper-parameters will be included in the ensemble. cfg <- SLEnsemble_cfg$new( learner_cfgs = list(SLLearner_cfg$new("SL.glm")) ) cfg <- cfg$add_sublearner("SL.gam", list(deg.gam = c(2, 3)))


Method clone()

The objects of this class are cloneable with this method.

Usage

SLEnsemble_cfg$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

SLEnsemble_cfg$new(
learner_cfgs = list(SLLearner_cfg$new("SL.glm"), SLLearner_cfg$new("SL.gam"))
)
#> <SLEnsemble_cfg>
#>   Inherits from: <Model_cfg>
#>   Public:
#>     SL.env: environment
#>     SL.library: SL.glm SL.gam
#>     add_sublearner: function (learner_name, hps = NULL) 
#>     clone: function (deep = FALSE) 
#>     cvControl: list
#>     family: family
#>     initialize: function (cvControl = NULL, learner_cfgs = NULL, family = stats::gaussian()) 
#>     model_class: SL

## ------------------------------------------------
## Method `SLEnsemble_cfg$new`
## ------------------------------------------------

SLEnsemble_cfg$new(
learner_cfgs = list(SLLearner_cfg$new("SL.glm"), SLLearner_cfg$new("SL.gam"))
)
#> <SLEnsemble_cfg>
#>   Inherits from: <Model_cfg>
#>   Public:
#>     SL.env: environment
#>     SL.library: SL.glm SL.gam
#>     add_sublearner: function (learner_name, hps = NULL) 
#>     clone: function (deep = FALSE) 
#>     cvControl: list
#>     family: family
#>     initialize: function (cvControl = NULL, learner_cfgs = NULL, family = stats::gaussian()) 
#>     model_class: SL