Skip to contents

Evolutionary learning of globally optimal classification trees. Calls evtree::evtree() fromevtree.

Initial parameter values

pmutatemajor, pmutateminor, pcrossover, psplit, and pprune, are scaled internally to sum to 100.

See also

Author

annanzrv

Super classes

mlr3::Learner -> mlr3::LearnerClassif -> LearnerClassifEvtree

Methods

Inherited methods


LearnerClassifEvtree$new()

Creates a new instance of this R6 class.

Usage


LearnerClassifEvtree$clone()

The objects of this class are cloneable with this method.

Usage

LearnerClassifEvtree$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = lrn("classif.evtree")
print(learner)
#> 
#> ── <LearnerClassifEvtree> (classif.evtree): Evolutionary learning of globally op
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3 and evtree
#> • Predict Types: [response] and prob
#> • Feature Types: integer, numeric, and factor
#> • Encapsulation: none (fallback: -)
#> • Properties: multiclass, twoclass, and weights
#> • Other settings: use_weights = 'use', predict_raw = 'FALSE'

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

# Create train and test set
ids = 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] V49 < 0.0777
#> |   |   [3] V22 < 0.7333
#> |   |   |   [4] V37 < 0.2413
#> |   |   |   |   [5] V49 < 0.0364: R (n = 15, err = 13.3%)
#> |   |   |   |   [6] V49 >= 0.0364: M (n = 11, err = 0.0%)
#> |   |   |   [7] V37 >= 0.2413: R (n = 36, err = 0.0%)
#> |   |   [8] V22 >= 0.7333
#> |   |   |   [9] V43 < 0.1788
#> |   |   |   |   [10] V8 < 0.14: R (n = 14, err = 7.1%)
#> |   |   |   |   [11] V8 >= 0.14: M (n = 8, err = 12.5%)
#> |   |   |   [12] V43 >= 0.1788: M (n = 31, err = 9.7%)
#> |   [13] V49 >= 0.0777: M (n = 24, err = 12.5%)
#> 
#> Number of inner nodes:    6
#> Number of terminal nodes: 7


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

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