mlr_learners_classif.mob: Classification Model-based Recursive Partitioning Learner

mlr_learners_classif.mobR Documentation

Classification Model-based Recursive Partitioning Learner

Description

Model-based recursive partitioning algorithm. Calls partykit::mob() from mob.

Dictionary

This Learner can be instantiated via lrn():

lrn("classif.mob")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

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

  • Required Packages: mlr3, mlr3extralearners, partykit, sandwich, coin

Parameters

Id Type Default Levels Range
rhs untyped - -
fit untyped - -
offset untyped - -
cluster untyped - -
alpha numeric 0.05 [0, 1]
bonferroni logical TRUE TRUE, FALSE -
minsize integer - [1, \infty)
minsplit integer - [1, \infty)
minbucket integer - [1, \infty)
maxdepth integer Inf [0, \infty)
mtry integer Inf [0, \infty)
trim numeric 0.1 [0, \infty)
breakties logical FALSE TRUE, FALSE -
parm untyped - -
dfsplit integer - [0, \infty)
prune untyped - -
restart logical TRUE TRUE, FALSE -
verbose logical FALSE TRUE, FALSE -
caseweights logical TRUE TRUE, FALSE -
ytype character vector vector, matrix, data.frame -
xtype character matrix vector, matrix, data.frame -
terminal untyped "object" -
inner untyped "object" -
model logical TRUE TRUE, FALSE -
numsplit character left left, center -
catsplit character binary binary, multiway -
vcov character opg opg, info, sandwich -
ordinal character chisq chisq, max, L2 -
nrep integer 10000 [0, \infty)
applyfun untyped - -
cores integer NULL (-\infty, \infty)
additional untyped - -
predict_fun untyped - -

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifMob

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
LearnerClassifMob$new()

Method clone()

The objects of this class are cloneable with this method.

Usage
LearnerClassifMob$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

sumny

References

Hothorn T, Zeileis A (2015). “partykit: A Modular Toolkit for Recursive Partytioning in R.” Journal of Machine Learning Research, 16(118), 3905-3909. http://jmlr.org/papers/v16/hothorn15a.html.

Hothorn T, Hornik K, Zeileis A (2006). “Unbiased Recursive Partitioning: A Conditional Inference Framework.” Journal of Computational and Graphical Statistics, 15(3), 651–674. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1198/106186006x133933")}, https://doi.org/10.1198/106186006x133933.

See Also

Examples


library(mlr3)
logit_ = function(y, x, start = NULL, weights = NULL, offset = NULL, ...) {
  glm(y ~ 1, family = binomial, start = start, ...)
}
learner = LearnerClassifMob$new()
learner$param_set$values$rhs = "."
learner$param_set$values$fit = logit_
learner$param_set$values$additional = list(maxit = 100)
learner$feature_types = c("logical", "integer", "numeric", "factor", "ordered")
learner$properties = c("twoclass", "weights")

predict_fun = function(object, newdata, task, .type) {
  p = unname(predict(object, newdata = newdata, type = "response"))
  levs = task$levels(task$target_names)[[1L]]

  if (.type == "response") {
    ifelse(p < 0.5, levs[1L], levs[2L])
  } else {
    prob_vector_to_matrix(p, levs)
  }
}
task = tsk("breast_cancer")
learner$param_set$values$predict_fun = predict_fun
ids = partition(task)
learner$train(task, row_ids = ids$train)
learner$predict(task, row_ids = ids$test)


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