mlr_learners_surv.rfsrc | R Documentation |
Random survival forest.
Calls randomForestSRC::rfsrc()
from randomForestSRC.
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 internal randomForestSRC::predict.rfsrc()
function.
crank
: the expected mortality using mlr3proba::.surv_return()
.
This Learner can be instantiated via lrn():
lrn("surv.rfsrc")
Task type: “surv”
Predict Types: “crank”, “distr”
Feature Types: “logical”, “integer”, “numeric”, “factor”
Required Packages: mlr3, mlr3proba, mlr3extralearners, randomForestSRC, pracma
Id | Type | Default | Levels | Range |
ntree | integer | 500 | [1, \infty) |
|
mtry | integer | - | [1, \infty) |
|
mtry.ratio | numeric | - | [0, 1] |
|
nodesize | integer | 15 | [1, \infty) |
|
nodedepth | integer | - | [1, \infty) |
|
splitrule | character | logrank | logrank, bs.gradient, logrankscore | - |
nsplit | integer | 10 | [0, \infty) |
|
importance | character | FALSE | FALSE, TRUE, none, permute, random, anti | - |
block.size | integer | 10 | [1, \infty) |
|
bootstrap | character | by.root | by.root, by.node, none, by.user | - |
samptype | character | swor | swor, swr | - |
samp | untyped | - | - | |
membership | logical | FALSE | TRUE, FALSE | - |
sampsize | untyped | - | - | |
sampsize.ratio | numeric | - | [0, 1] |
|
na.action | character | na.omit | na.omit, na.impute | - |
nimpute | integer | 1 | [1, \infty) |
|
ntime | integer | 150 | [0, \infty) |
|
cause | integer | - | [1, \infty) |
|
proximity | character | FALSE | FALSE, TRUE, inbag, oob, all | - |
distance | character | FALSE | FALSE, TRUE, inbag, oob, all | - |
forest.wt | character | FALSE | FALSE, TRUE, inbag, oob, all | - |
xvar.wt | untyped | - | - | |
split.wt | untyped | - | - | |
forest | logical | TRUE | TRUE, FALSE | - |
var.used | character | FALSE | FALSE, all.trees, by.tree | - |
split.depth | character | FALSE | FALSE, all.trees, by.tree | - |
seed | integer | - | (-\infty, -1] |
|
do.trace | logical | FALSE | TRUE, FALSE | - |
statistics | logical | FALSE | TRUE, FALSE | - |
get.tree | untyped | - | - | |
outcome | character | train | train, test | - |
ptn.count | integer | 0 | [0, \infty) |
|
estimator | character | nelson | nelson, kaplan | - |
cores | integer | 1 | [1, \infty) |
|
save.memory | logical | FALSE | TRUE, FALSE | - |
perf.type | character | - | none | - |
case.depth | logical | FALSE | TRUE, FALSE | - |
estimator
: Hidden parameter that controls the type of estimator used to
derive the survival function during prediction. The default value is "chf"
which
uses a bootstrapped Nelson-Aalen estimator for the cumulative hazard function
H(t)
, (Ishwaran, 2008) from which we calculate S(t) = \exp(-H(t))
,
whereas "surv"
uses a bootstrapped Kaplan-Meier estimator to directly estimate
S(t)
.
mtry
: This hyperparameter can alternatively be set via the added
hyperparameter mtry.ratio
as mtry = max(ceiling(mtry.ratio * n_features), 1)
.
Note that mtry
and mtry.ratio
are mutually exclusive.
sampsize
: This hyperparameter can alternatively be set via the added
hyperparameter sampsize.ratio
as sampsize = max(ceiling(sampsize.ratio * n_obs), 1)
.
Note that sampsize
and sampsize.ratio
are mutually exclusive.
cores
: This value is set as the option rf.cores
during training and is
set to 1 by default.
ntime
: Number of time points to coerce the observed event times for use in the
estimated survival function during prediction. We changed the default value
of 150
to 0
in order to be in line with other random survival forest
learners and use all the unique event times from the train set.
mlr3::Learner
-> mlr3proba::LearnerSurv
-> LearnerSurvRandomForestSRC
new()
Creates a new instance of this R6 class.
LearnerSurvRandomForestSRC$new()
importance()
The importance scores are extracted from the model slot importance
.
LearnerSurvRandomForestSRC$importance()
Named numeric()
.
selected_features()
Selected features are extracted from the model slot var.used
.
LearnerSurvRandomForestSRC$selected_features()
character()
.
oob_error()
OOB error extracted from the model slot err.rate
.
LearnerSurvRandomForestSRC$oob_error()
numeric()
.
clone()
The objects of this class are cloneable with this method.
LearnerSurvRandomForestSRC$clone(deep = FALSE)
deep
Whether to make a deep clone.
RaphaelS1
Ishwaran H, Kogalur UB, Blackstone EH, Lauer MS (2008). “Random survival forests.” The Annals of Applied Statistics, 2(3). \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/08-aoas169")}, https://doi.org/10.1214/08-aoas169.
Breiman, Leo (2001). “Random Forests.” Machine Learning, 45(1), 5–32. ISSN 1573-0565, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1023/A:1010933404324")}.
Dictionary of Learners: mlr3::mlr_learners.
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.
# Define the Learner
learner = mlr3::lrn("surv.rfsrc", importance = "TRUE")
print(learner)
# Define a Task
task = mlr3::tsk("grace")
# 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)
print(learner$importance())
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.