Skip to contents

Classification Partition Tree where a significance test is used to determine the univariate splits. Calls partykit::ctree() from partykit.

Dictionary

This Learner can be instantiated via lrn():

lrn("classif.ctree")

Meta Information

  • Task type: “classif”

  • Predict Types: “response”, “prob”

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

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

Parameters

IdTypeDefaultLevelsRange
teststatcharacterquadraticquadratic, maximum-
splitstatcharacterquadraticquadratic, maximum-
splittestlogicalFALSETRUE, FALSE-
testtypecharacterBonferroniBonferroni, MonteCarlo, Univariate, Teststatistic-
nmaxuntyped--
alphanumeric0.05\([0, 1]\)
mincriterionnumeric0.95\([0, 1]\)
logmincriterionnumeric-\((-\infty, \infty)\)
minsplitinteger20\([1, \infty)\)
minbucketinteger7\([1, \infty)\)
minprobnumeric0.01\([0, 1]\)
stumplogicalFALSETRUE, FALSE-
lookaheadlogicalFALSETRUE, FALSE-
MIAlogicalFALSETRUE, FALSE-
nresampleinteger9999\([1, \infty)\)
tolnumeric-\([0, \infty)\)
maxsurrogateinteger0\([0, \infty)\)
numsurrogatelogicalFALSETRUE, FALSE-
mtryintegerInf\([0, \infty)\)
maxdepthintegerInf\([0, \infty)\)
multiwaylogicalFALSETRUE, FALSE-
splittryinteger2\([0, \infty)\)
intersplitlogicalFALSETRUE, FALSE-
majoritylogicalFALSETRUE, FALSE-
caseweightslogicalFALSETRUE, FALSE-
maxvarinteger-\([1, \infty)\)
applyfununtyped--
coresintegerNULL\((-\infty, \infty)\)
saveinfologicalTRUETRUE, FALSE-
updatelogicalFALSETRUE, FALSE-
splitflavourcharacterctreectree, exhaustive-
offsetuntyped--
clusteruntyped--
scoresuntyped--
doFitlogicalTRUETRUE, FALSE-
maxptsinteger25000\((-\infty, \infty)\)
absepsnumeric0.001\([0, \infty)\)
relepsnumeric0\([0, \infty)\)

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. doi:10.1198/106186006x133933 , https://doi.org/10.1198/106186006x133933.

See also

Author

sumny

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifCTree

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

LearnerClassifCTree$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = mlr3::lrn("classif.ctree")
print(learner)
#> <LearnerClassifCTree:classif.ctree>: Conditional Inference Tree
#> * Model: -
#> * Parameters: list()
#> * Packages: mlr3, mlr3extralearners, partykit, sandwich, coin
#> * Predict Types:  [response], prob
#> * Feature Types: integer, numeric, factor, ordered
#> * Properties: multiclass, twoclass, weights

# Define a Task
task = mlr3::tsk("sonar")

# Create train and test set
ids = mlr3::partition(task)

# Train the learner on the training ids
learner$train(task, row_ids = ids$train)

print(learner$model)
#> 
#> Model formula:
#> Class ~ V1 + V10 + V11 + V12 + V13 + V14 + V15 + V16 + V17 + 
#>     V18 + V19 + V2 + V20 + V21 + V22 + V23 + V24 + V25 + V26 + 
#>     V27 + V28 + V29 + V3 + V30 + V31 + V32 + V33 + V34 + V35 + 
#>     V36 + V37 + V38 + V39 + V4 + V40 + V41 + V42 + V43 + V44 + 
#>     V45 + V46 + V47 + V48 + V49 + V5 + V50 + V51 + V52 + V53 + 
#>     V54 + V55 + V56 + V57 + V58 + V59 + V6 + V60 + V7 + V8 + 
#>     V9
#> 
#> Fitted party:
#> [1] root
#> |   [2] V11 <= 0.1742
#> |   |   [3] V4 <= 0.0581: R (n = 48, err = 6.2%)
#> |   |   [4] V4 > 0.0581: M (n = 8, err = 25.0%)
#> |   [5] V11 > 0.1742: M (n = 83, err = 24.1%)
#> 
#> Number of inner nodes:    2
#> Number of terminal nodes: 3


# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)

# Score the predictions
predictions$score()
#> classif.ce 
#>  0.3043478