Classification Gradient Boosting Learner
Source:R/learner_bst_classif_bst.R
mlr_learners_classif.bst.Rd
Classification gradient boosting learner.
Calls bst::bst()
from bst.
Initial parameter values
Learner = "ls"
: Default base learner typexval = 0
: No cross-validationmaxdepth = 1
: Maximum tree depth
Meta Information
Task type: “classif”
Predict Types: “response”, “prob”
Feature Types: “numeric”
Required Packages: mlr3, mlr3extralearners, bst, rpart
Parameters
Id | Type | Default | Levels | Range |
center | logical | FALSE | TRUE, FALSE | - |
coefir | untyped | NULL | - | |
cost | numeric | 0.5 | \([0, 1]\) | |
cp | numeric | 0.01 | \([0, 1]\) | |
df | integer | 4 | \([1, \infty)\) | |
family | character | hinge | hinge, hinge2, binom, thingeDC, tbinomDC, binomdDC, loss, clossR, clossRMM, clossMM | - |
f.init | untyped | NULL | - | |
fk | untyped | NULL | - | |
intercept | logical | TRUE | TRUE, FALSE | - |
iter | integer | 1 | \([1, \infty)\) | |
Learner | character | ls | ls, sm, tree | - |
maxdepth | integer | 1 | \([1, 30]\) | |
maxsurrogate | integer | 5 | \([0, \infty)\) | |
minbucket | integer | - | \([1, \infty)\) | |
minsplit | integer | 20 | \([1, \infty)\) | |
mstop | integer | 50 | \([1, \infty)\) | |
numsample | integer | 50 | \([1, \infty)\) | |
nu | numeric | 0.1 | \([0, 1]\) | |
q | numeric | - | \([0, 1]\) | |
qh | numeric | - | \([0, 1]\) | |
s | numeric | - | \([0, \infty)\) | |
sh | numeric | - | \([0, \infty)\) | |
start | logical | FALSE | TRUE, FALSE | - |
surrogatestyle | integer | 0 | \([0, 1]\) | |
threshold | character | adaptive | adaptive, fixed | - |
trace | logical | FALSE | TRUE, FALSE | - |
trun | logical | FALSE | TRUE, FALSE | - |
twinboost | logical | FALSE | TRUE, FALSE | - |
twintype | integer | 1 | \([1, 2]\) | |
xselect.init | untyped | NULL | - | |
xval | integer | 10 | \([0, \infty)\) |
See also
as.data.table(mlr_learners)
for a table of available Learners in the running session (depending on the loaded packages).Chapter in the mlr3book: https://mlr3book.mlr-org.com/basics.html#learners
mlr3learners for a selection of recommended learners.
mlr3cluster for unsupervised clustering learners.
mlr3pipelines to combine learners with pre- and postprocessing steps.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Super classes
mlr3::Learner
-> mlr3::LearnerClassif
-> LearnerClassifBst
Methods
Inherited methods
mlr3::Learner$base_learner()
mlr3::Learner$configure()
mlr3::Learner$encapsulate()
mlr3::Learner$format()
mlr3::Learner$help()
mlr3::Learner$predict()
mlr3::Learner$predict_newdata()
mlr3::Learner$print()
mlr3::Learner$reset()
mlr3::Learner$selected_features()
mlr3::Learner$train()
mlr3::LearnerClassif$predict_newdata_fast()
Examples
# Define the Learner
learner = lrn("classif.bst")
print(learner)
#>
#> ── <LearnerClassifBst> (classif.bst): Gradient Boosting ────────────────────────
#> • Model: -
#> • Parameters: Learner=ls, maxdepth=1, xval=0
#> • Packages: mlr3, mlr3extralearners, bst, and rpart
#> • Predict Types: [response] and prob
#> • Feature Types: numeric
#> • Encapsulation: none (fallback: -)
#> • Properties: twoclass
#> • Other settings: use_weights = 'error'
# 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)
#>
#> Models Fitted with Gradient Boosting
#>
#> Call:
#> bst::bst(x = data[, features, with = FALSE], y = data[[target]], ctrl = ctrl, control.tree = ctrl_tree, learner = pars$Learner)
#>
#> [1] "gaussian"
#>
#> Base learner: ls
#> Number of boosting iterations: mstop = 50
#> Step size: 0.1
#> Offset: 0.03597122
#>
#> Coefficients:
#> V1 V10 V11 V12 V13 V14 V15
#> 0.0000000 0.0000000 0.2030958 0.0000000 0.0000000 0.0000000 0.0000000
#> V16 V17 V18 V19 V2 V20 V21
#> 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> V22 V23 V24 V25 V26 V27 V28
#> 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> V29 V3 V30 V31 V32 V33 V34
#> 0.0000000 0.0000000 0.0000000 -0.0413024 0.0000000 0.0000000 0.0000000
#> V35 V36 V37 V38 V39 V4 V40
#> 0.0000000 -0.6140020 0.0000000 0.0000000 0.0000000 0.8660938 0.0000000
#> V41 V42 V43 V44 V45 V46 V47
#> 0.0000000 0.0000000 0.0000000 0.0000000 0.7859369 0.0000000 0.0000000
#> V48 V49 V5 V50 V51 V52 V53
#> 0.0000000 1.1591990 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> V54 V55 V56 V57 V58 V59 V6
#> 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> V60 V7 V8 V9
#> 0.0000000 0.0000000 0.0000000 0.0000000
#> attr(,"offset")
#> [1] 0.03597122
#>
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> classif.ce
#> 0.2608696