This learner uses glmtree from partykit to fit recursive partitioning and regression trees in a generalized linear model.

Format

R6Class object.

Value

Learner object with methods for training and prediction. See Lrnr_base for documentation on learners.

Parameters

  • formula: An optional object of class formula (or one that can be coerced to that class), which a symbolic description of the generalized linear model to be fit. If not specified a main terms regression model will be supplied, with each covariate included as a term. Please consult glmtree documentation for more information on its use of formula, and for a description on formula syntax consult the details of the glm documentation.

  • ...: Other parameters passed to mob_control or glmtree that are not already specified in the sl3_Task. See its documentation for details.

Examples

data(cpp_imputed)
# create task for prediction
cpp_task <- sl3_Task$new(
  data = cpp_imputed,
  covariates = c("bmi", "parity", "mage", "sexn"),
  outcome = "haz"
)
# initialization, training, and prediction with the defaults
glmtree_lrnr <- Lrnr_glmtree$new()
glmtree_fit <- glmtree_lrnr$train(cpp_task)
glmtree_preds <- glmtree_fit$predict()