Wrapper around PipeOpDistrCompositor or PipeOpBreslow to simplify Graph creation.
Usage
pipeline_distrcompositor(
learner,
estimator = "kaplan",
form = "aft",
overwrite = FALSE,
scale_lp = 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.- estimator
(
character(1)
)
One ofkaplan
(default),nelson
orbreslow
, corresponding to the Kaplan-Meier, Nelson-Aalen and Breslow estimators respectively. Used to estimate the baseline survival distribution.- form
(
character(1)
)
One ofaft
(default),ph
, orpo
, corresponding to accelerated failure time, proportional hazards, and proportional odds respectively. Used to determine the form of the composed survival distribution. Ignored if estimator isbreslow
.- overwrite
(
logical(1)
)
IfFALSE
(default) then if thelearner
already has adistr
, the compositor does nothing. IfTRUE
then thedistr
is overwritten by the compositor if already present, which may be required for changing the predictiondistr
from one model form to another.- scale_lp
(
logical(1)
)
IfTRUE
andform
is"aft"
, the linear predictor scores are scaled before the composition. Experimental option, see more details on PipeOpDistrCompositor. Default isFALSE
.- 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(mlr3pipelines)
# let's change the distribution prediction of Cox (Breslow-based) to an AFT form:
task = tsk("rats")
grlrn = ppl(
"distrcompositor",
learner = lrn("surv.coxph"),
estimator = "kaplan",
form = "aft",
overwrite = TRUE,
graph_learner = TRUE
)
grlrn$train(task)
grlrn$predict(task)
} # }