BlockForest Survival Learner
Source:R/learner_blockForest_surv_blockforest.R
mlr_learners_surv.blockforest.RdRandom survival forests for blocks of clinical and omics covariate data.
Calls blockForest::blockfor() from package blockForest.
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.
Prediction types
This learner returns two prediction types:
distr: a survival matrix in two dimensions, where observations are represented in rows and (unique event) time points in columns. Calculated using the internalblockForest:::predict.blockForest()function.crank: the expected mortality usingmlr3proba::surv_return().
Initial parameter values
num.threadsis initialized to 1 to avoid conflicts with parallelization via future.
Meta Information
Task type: “surv”
Predict Types: “crank”, “distr”
Feature Types: “logical”, “integer”, “numeric”, “factor”, “ordered”
Required Packages: mlr3, mlr3proba, mlr3extralearners, blockForest
Parameters
| Id | Type | Default | Levels | Range |
| blocks | untyped | - | - | |
| block.method | character | BlockForest | BlockForest, RandomBlock, BlockVarSel, VarProb, SplitWeights | - |
| num.trees | integer | 2000 | \([1, \infty)\) | |
| mtry | untyped | NULL | - | |
| nsets | integer | 300 | \([1, \infty)\) | |
| num.trees.pre | integer | 1500 | \([1, \infty)\) | |
| splitrule | character | extratrees | logrank, extratrees, C, maxstat | - |
| always.select.block | integer | 0 | \([0, 1]\) | |
| importance | character | - | none, impurity, impurity_corrected, permutation | - |
| num.threads | integer | - | \([1, \infty)\) | |
| seed | integer | NULL | \((-\infty, \infty)\) | |
| verbose | logical | TRUE | TRUE, FALSE | - |
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
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 -> mlr3proba::LearnerSurv -> LearnerSurvBlockForest
Methods
Method importance()
The importance scores are extracted from the model slot variable.importance.
Returns
Named numeric().
Examples
# Define a Task
task = tsk("grace")
# Create train and test set
ids = partition(task)
# check task's features
task$feature_names
#> [1] "age" "los" "revasc" "revascdays" "stchange"
#> [6] "sysbp"
# partition features to 2 blocks
blocks = list(bl1 = 1:3, bl2 = 4:6)
# define learner
learner = lrn("surv.blockforest", blocks = blocks,
importance = "permutation", nsets = 10,
num.trees = 50, num.trees.pre = 10, splitrule = "logrank")
# Train the learner on the training ids
learner$train(task, row_ids = ids$train)
# feature importance
learner$importance()
#> revascdays revasc age los stchange sysbp
#> 0.115329328 0.066221644 0.023003004 0.022571836 0.009474309 0.009161520
# Make predictions for the test observations
pred = learner$predict(task, row_ids = ids$test)
pred
#>
#> ── <PredictionSurv> for 330 observations: ──────────────────────────────────────
#> row_ids time status crank distr
#> 1 180.0 FALSE 22.77041 <list[1]>
#> 13 180.0 FALSE 36.08494 <list[1]>
#> 15 5.0 FALSE 15.59028 <list[1]>
#> --- --- --- --- ---
#> 989 67.0 TRUE 70.16141 <list[1]>
#> 995 0.5 TRUE 72.13328 <list[1]>
#> 996 69.0 TRUE 66.86035 <list[1]>
# Score the predictions
pred$score()
#> surv.cindex
#> 0.8324199