mlr_learners_surv.ranger: Ranger Survival Learner

mlr_learners_surv.rangerR Documentation

Ranger Survival Learner

Description

Random survival forest. Calls ranger::ranger() from package ranger.

Prediction types

This learner returns two prediction types:

  1. distr: a survival matrix in two dimensions, where observations are represented in rows and (unique event) time points in columns. Calculated using the internal ranger::predict.ranger() function.

  2. crank: the expected mortality using mlr3proba::.surv_return().

Custom mlr3 parameters

  • mtry: This hyperparameter can alternatively be set via our hyperparameter mtry.ratio as mtry = max(ceiling(mtry.ratio * n_features), 1). Note that mtry and mtry.ratio are mutually exclusive.

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("surv.ranger")

Meta Information

  • Task type: “surv”

  • Predict Types: “crank”, “distr”

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

  • Required Packages: mlr3, mlr3proba, mlr3extralearners, ranger

Parameters

Id Type Default Levels Range
alpha numeric 0.5 (-\infty, \infty)
always.split.variables untyped - -
holdout logical FALSE TRUE, FALSE -
importance character - none, impurity, impurity_corrected, permutation -
keep.inbag logical FALSE TRUE, FALSE -
max.depth integer NULL [0, \infty)
min.node.size integer 5 [1, \infty)
minprop numeric 0.1 (-\infty, \infty)
mtry integer - [1, \infty)
mtry.ratio numeric - [0, 1]
num.random.splits integer 1 [1, \infty)
num.threads integer 1 [1, \infty)
num.trees integer 500 [1, \infty)
oob.error logical TRUE TRUE, FALSE -
regularization.factor untyped 1 -
regularization.usedepth logical FALSE TRUE, FALSE -
replace logical TRUE TRUE, FALSE -
respect.unordered.factors character ignore ignore, order, partition -
sample.fraction numeric - [0, 1]
save.memory logical FALSE TRUE, FALSE -
scale.permutation.importance logical FALSE TRUE, FALSE -
seed integer NULL (-\infty, \infty)
split.select.weights numeric - [0, 1]
splitrule character logrank logrank, extratrees, C, maxstat -
verbose logical TRUE TRUE, FALSE -
write.forest logical TRUE TRUE, FALSE -
min.bucket integer 3 (-\infty, \infty)
time.interest integer NULL [1, \infty)
node.stats logical FALSE TRUE, FALSE -

Super classes

mlr3::Learner -> mlr3proba::LearnerSurv -> LearnerSurvRanger

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
LearnerSurvRanger$new()

Method importance()

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

Usage
LearnerSurvRanger$importance()
Returns

Named numeric().


Method oob_error()

The out-of-bag error is extracted from the model slot prediction.error.

Usage
LearnerSurvRanger$oob_error()
Returns

numeric(1).


Method clone()

The objects of this class are cloneable with this method.

Usage
LearnerSurvRanger$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

be-marc

References

Wright, N. M, Ziegler, Andreas (2017). “ranger: A Fast Implementation of Random Forests for High Dimensional Data in C++ and R.” Journal of Statistical Software, 77(1), 1–17. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v077.i01")}.

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")}.

See Also

Examples


# Define the Learner
learner = mlr3::lrn("surv.ranger", importance = "permutation")
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()


mlr-org/mlr3extralearners documentation built on Nov. 11, 2024, 11:11 a.m.