Regression Regularized Random Forest Learner
Source:R/learner_RRF_regr_RRF.R
mlr_learners_regr.RRF.RdRegularized random forest for regression.
Calls RRF::RRF() from RRF.
Meta Information
Task type: “regr”
Predict Types: “response”
Feature Types: “integer”, “numeric”, “factor”
Required Packages: mlr3, mlr3extralearners, RRF
Parameters
| Id | Type | Default | Levels | Range |
| ntree | integer | 500 | \([1, \infty)\) | |
| mtry | integer | - | \([1, \infty)\) | |
| nodesize | integer | - | \([1, \infty)\) | |
| replace | logical | TRUE | TRUE, FALSE | - |
| flagReg | integer | 1 | \([0, \infty)\) | |
| coefReg | numeric | 0.8 | \((-\infty, \infty)\) | |
| feaIni | untyped | - | - | |
| corr.bias | logical | FALSE | TRUE, FALSE | - |
| maxnodes | integer | - | \([1, \infty)\) | |
| importance | logical | FALSE | TRUE, FALSE | - |
| localImp | logical | FALSE | TRUE, FALSE | - |
| nPerm | integer | 1 | \([1, \infty)\) | |
| proximity | logical | FALSE | TRUE, FALSE | - |
| oob.prox | logical | FALSE | TRUE, FALSE | - |
| do.trace | logical | FALSE | TRUE, FALSE | - |
| keep.inbag | logical | FALSE | TRUE, FALSE | - |
| keep.forest | logical | TRUE | TRUE, FALSE | - |
| strata | untyped | - | - | |
| sampsize | untyped | - | - | |
| predict.all | logical | FALSE | TRUE, FALSE | - |
| nodes | logical | FALSE | TRUE, FALSE | - |
References
Deng, Houtao, Runger, George (2012). “Feature selection via regularized trees.” In 2012 International Joint Conference on Neural Networks (IJCNN), 1–8. IEEE. doi:10.1109/IJCNN.2012.6252640 .
Deng, Houtao, Runger, George (2013). “Gene selection with guided regularized random forest.” Pattern Recognition, 46(12), 3483–3489. doi:10.1016/j.patcog.2013.05.021 .
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 -> LearnerRegrRRF
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()
Method importance()
The importance scores are extracted from the slot importance.
Returns
Named numeric().
Examples
# Define the Learner
learner = lrn("regr.RRF")
print(learner)
#>
#> ── <LearnerRegrRRF> (regr.RRF): Regularized Random Forest ──────────────────────
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3, mlr3extralearners, and RRF
#> • Predict Types: [response]
#> • Feature Types: integer, numeric, and factor
#> • Encapsulation: none (fallback: -)
#> • Properties: importance and oob_error
#> • 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)
#>
#> Call:
#> RRF(formula = task$formula(), data = task$data())
#> Type of random forest: regression
#> Number of trees: 500
#> No. of variables tried at each split: 3
#>
#> Mean of squared residuals: 7.789201
#> % Var explained: 81.25
print(learner$importance())
#> disp wt cyl hp carb drat gear qsec
#> 206.70448 165.11618 138.55141 121.29424 56.86631 48.55964 24.26459 20.13651
#> vs am
#> 16.11049 11.93123
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> regr.mse
#> 2.907525