Skip to contents

Accelerated oblique random regression forest. Calls aorsf::orsf() from aorsf.

Initial parameter values

  • n_thread: This parameter is initialized to 1 (default is 0) to avoid conflicts with the mlr3 parallelization.

  • pred_simplify has to be TRUE, otherwise response is NA in prediction

See also

Author

annanzrv

Super classes

mlr3::Learner -> mlr3::LearnerRegr -> LearnerRegrObliqueRandomForest

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.


Method oob_error()

OOB concordance error extracted from the model slot eval_oobag$stat_values

Usage

LearnerRegrObliqueRandomForest$oob_error()

Returns

numeric().


Method importance()

The importance scores are extracted from the model.

Usage

LearnerRegrObliqueRandomForest$importance()

Returns

Named numeric().


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerRegrObliqueRandomForest$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = mlr3::lrn("regr.aorsf", importance = "anova")
print(learner)
#> 
#> ── <LearnerRegrObliqueRandomForest> (regr.aorsf): Oblique Random Forest Regresso
#> • Model: -
#> • Parameters: importance=anova, n_thread=1
#> • Packages: mlr3, mlr3extralearners, and aorsf
#> • Predict Types: [response]
#> • Feature Types: logical, integer, numeric, factor, and ordered
#> • Encapsulation: none (fallback: -)
#> • Properties: importance, oob_error, and weights
#> • Other settings: use_weights = 'use'

# Define a Task
task = mlr3::tsk("mtcars")
# 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)
#> ---------- Oblique random regression forest
#> 
#>      Linear combinations: Linear regression
#>           N observations: 21
#>                  N trees: 500
#>       N predictors total: 10
#>    N predictors per node: 4
#>  Average leaves per tree: 3.254
#> Min observations in leaf: 5
#>           OOB stat value: 0.64
#>            OOB stat type: RSQ
#>      Variable importance: anova
#> 
#> -----------------------------------------
print(learner$importance())
#>          am          hp        qsec         cyl          wt        carb 
#> 0.096676737 0.075324675 0.073369565 0.073089701 0.048128342 0.035519126 
#>        disp        gear          vs        drat 
#> 0.029411765 0.017341040 0.014388489 0.008152174 

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

# Score the predictions
predictions$score()
#> regr.mse 
#> 13.81936