Estimate Survival Time/Response Predict Type Pipeline
Source:R/pipelines.R
mlr_graphs_responsecompositor.Rd
Wrapper around PipeOpResponseCompositor to simplify Graph creation.
Usage
pipeline_responsecompositor(
learner,
method = "rmst",
tau = NULL,
add_crank = FALSE,
overwrite = FALSE,
graph_learner = FALSE
)
Arguments
- learner
[mlr3::Learner]|[mlr3pipelines::PipeOp]|[mlr3pipelines::Graph]
Either aLearner
which will be wrapped in mlr3pipelines::PipeOpLearner, aPipeOp
which will be wrapped in mlr3pipelines::Graph or aGraph
itself. UnderlyingLearner
should be LearnerSurv.- method
(
character(1)
)
Determines what method should be used to produce a survival time (response) from the survival distribution. Available methods are"rmst"
and"median"
, corresponding to the restricted mean survival time and the median survival time respectively.- tau
(
numeric(1)
)
Determines the time point up to which we calculate the restricted mean survival time (works only for the"rmst"
method). IfNULL
(default), all the available time points in the predicted survival distribution will be used.- add_crank
(
logical(1)
)
IfTRUE
thencrank
predict type will be set as-response
(as higher survival times correspond to lower risk). Works only ifoverwrite
isTRUE
.- overwrite
(
logical(1)
)
IfFALSE
(default) and the prediction already has aresponse
prediction, then the compositor returns the input prediction unchanged. IfTRUE
, then theresponse
(and thecrank
, ifadd_crank
isTRUE
) will be overwritten.- graph_learner
(
logical(1)
)
IfTRUE
returns wraps the Graph as a GraphLearner otherwise (default) returns as aGraph
.
Dictionary
This Graph can be instantiated via the dictionary mlr_graphs or with the associated sugar function ppl():
Examples
if (FALSE) { # \dontrun{
library(mlr3)
library(mlr3pipelines)
task = tsk("lung")
part = partition(task)
# add survival time prediction type to the predictions of a Cox model
grlrn = ppl(
"responsecompositor",
learner = lrn("surv.coxph"),
method = "rmst",
overwrite = TRUE,
graph_learner = TRUE
)
grlrn$train(task, part$train)
grlrn$predict(task, part$test)
} # }