Bayesian CART regression model.
Calls tgp::bcart() from tgp.
For the predicted mean ZZ.km and for the predicted variance ZZ.ks2 are chosen.
Factor features are one-hot encoded with reference encoding before fitting, matching the
behavior of the original mlr learner. If factors are present, basemax is set to the number
of non-factor features so that tree proposals account for the numeric part of the design.
Initial parameter values
verbis initialized to0to silence printing.pred.nis initialized toFALSEto skip prediction during training.
Meta Information
Task type: “regr”
Predict Types: “response”, “se”
Feature Types: “integer”, “numeric”, “factor”
Required Packages: mlr3, mlr3extralearners, tgp
Parameters
| Id | Type | Default | Levels | Range |
| bprior | character | bflat | b0, b0not, bflat, bmle, bmznot, bmzt | - |
| Ds2x | logical | FALSE | TRUE, FALSE | - |
| improv | logical | FALSE | TRUE, FALSE | - |
| itemps | untyped | NULL | - | |
| krige | logical | TRUE | TRUE, FALSE | - |
| m0r1 | logical | TRUE | TRUE, FALSE | - |
| pred.n | logical | - | TRUE, FALSE | - |
| R | integer | 1 | \([1, \infty)\) | |
| trace | logical | FALSE | TRUE, FALSE | - |
| verb | integer | - | \([0, 4]\) | |
| zcov | logical | FALSE | TRUE, FALSE | - |
| tree | untyped | c(0.5, 2) | - | |
| BTE | untyped | c(2000L, 7000L, 2L) | - |
References
Gramacy RB (2007). “tgp: An R Package for Bayesian Nonstationary, Semiparametric Nonlinear Regression and Design by Treed Gaussian Process Models.” Journal of Statistical Software, 19(9), 1–46. doi:10.18637/jss.v019.i09 .
Gramacy RB, Taddy M (2010). “Categorical Inputs, Sensitivity Analysis, Optimization and Importance Tempering with tgp Version 2, an R Package for Treed Gaussian Process Models.” Journal of Statistical Software, 33(6), 1–48. doi:10.18637/jss.v033.i06 .
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::LearnerRegr -> LearnerRegrBcart
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::LearnerRegr$predict_newdata_fast()
Examples
# Define the Learner
learner = lrn("regr.bcart")
print(learner)
#>
#> ── <LearnerRegrBcart> (regr.bcart): Bayesian CART ──────────────────────────────
#> • Model: -
#> • Parameters: pred.n=FALSE, verb=0
#> • Packages: mlr3, mlr3extralearners, and tgp
#> • Predict Types: [response] and se
#> • Feature Types: integer, numeric, and factor
#> • Encapsulation: none (fallback: -)
#> • Properties:
#> • Other settings: use_weights = 'error'
# Define a Task
task = tsk("mtcars")
# 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
#>
#> This is a 'tgp' class object.
#> It is basically a list with the following entries:
#>
#> [1] X n d Z nn Xsplit BTE R
#> [9] linburn g dparams itemps bimprov ess gpcs response
#> [17] improv parts trees posts params m0r1
#>
#> See ?btgp for an explanation of the individual entries.
#> See plot.tgp and tgp.trees for help with visualization.
#>
#> The $trace field, if it exists, is of class 'tgptraces'
#> and has its own print statement
#>
#>
#> $factor_levels
#> list()
#>
#> $column_names
#> [1] "am" "carb" "cyl" "disp" "drat" "gear" "hp" "qsec" "vs" "wt"
#>
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> regr.mse
#> 42.80774