Skip to contents

Random forests for blocks of clinical and omics covariate data. Calls blockForest::blockfor() from package blockForest. The training model includes only the $forest slot, excluding the paramvalues and the biased_oob_error_donotuse.

In this learner, only the trained forest object ($forest) is retained. The optimized block-specific tuning parameters (paramvalues) and the biased OOB error estimate (biased_oob_error_donotuse) are discarded, as they are either not needed for downstream use or not reliable for performance estimation.

Initial parameter values

  • num.threads is initialized to 1 to avoid conflicts with parallelization via future.

Dictionary

This Learner can be instantiated via lrn():

lrn("regr.blockforest")

Meta Information

  • Task type: “regr”

  • Predict Types: “response”, “se”

  • Feature Types: “logical”, “integer”, “numeric”, “factor”, “ordered”

  • Required Packages: mlr3, mlr3extralearners, blockForest

Parameters

IdTypeDefaultLevelsRange
blocksuntyped--
block.methodcharacterBlockForestBlockForest, RandomBlock, BlockVarSel, VarProb, SplitWeights-
num.treesinteger2000\([1, \infty)\)
mtryuntypedNULL-
nsetsinteger300\([1, \infty)\)
num.trees.preinteger1500\([1, \infty)\)
splitrulecharacterextratreesextratrees, variance, maxstat-
always.select.blockinteger0\([0, 1]\)
importancecharacter-none, impurity, impurity_corrected, permutation-
num.threadsinteger-\([1, \infty)\)
seedintegerNULL\((-\infty, \infty)\)
verboselogicalTRUETRUE, FALSE-
se.methodcharacterinfjackjack, infjack-

References

Hornung, R., Wright, N. M (2019). “Block Forests: Random forests for blocks of clinical and omics covariate data.” BMC Bioinformatics, 20(1), 1–17. doi:10.1186/s12859-019-2942-y , https://doi.org/10.1186/s12859-019-2942-y.

See also

Author

bblodfon

Super classes

mlr3::Learner -> mlr3::LearnerRegr -> LearnerRegrBlockForest

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.


Method importance()

The importance scores are extracted from the model slot variable.importance.

Usage

LearnerRegrBlockForest$importance()

Returns

Named numeric().


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerRegrBlockForest$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define a Task
task = tsk("mtcars")
# Create train and test set
ids = partition(task)
# check task's features
task$feature_names
#>  [1] "am"   "carb" "cyl"  "disp" "drat" "gear" "hp"   "qsec" "vs"   "wt"  
# partition features to 2 blocks
blocks = list(bl1 = 1:3, bl2 = 4:10)
# define learner
learner = lrn("regr.blockforest", blocks = blocks,
              importance = "permutation", nsets = 10,
              num.trees = 50, num.trees.pre = 10, splitrule = "variance")
# Train the learner on the training ids
learner$train(task, row_ids = ids$train)
# feature importance
learner$importance()
#>         wt         hp         vs       disp        cyl       carb         am 
#>  8.4713952  7.5828266  5.6969229  5.4177273  4.4391957  2.7041205  0.6635873 
#>       drat       qsec       gear 
#>  0.1278571 -0.3813087 -0.6355797 
# Make predictions for the test observations
pred = learner$predict(task, row_ids = ids$test)
pred
#> 
#> ── <PredictionRegr> for 11 observations: ───────────────────────────────────────
#>  row_ids truth response
#>        1  21.0 20.34989
#>        8  24.4 23.56050
#>       10  19.2 18.92397
#>      ---   ---      ---
#>       24  13.3 16.33338
#>       27  26.0 23.56303
#>       30  19.7 18.07580
# Score the predictions
pred$score()
#> regr.mse 
#> 6.222504