Wrap a learner into a PipeOp with survival predictions estimated by the Breslow estimator
Source:R/PipeOpBreslow.R
mlr_pipeops_compose_breslow_distr.Rd
Composes a survival distribution (distr
) using the linear predictor
predictions (lp
) from a given LearnerSurv during training and prediction,
utilizing the breslow estimator. The specified learner
must be
capable of generating lp
-type predictions (e.g., a Cox-type model).
Dictionary
This PipeOp can be instantiated via the Dictionary mlr_pipeops or with the associated sugar function po():
Input and Output Channels
PipeOpBreslow is like a LearnerSurv.
It has one input channel, named input
that takes a TaskSurv during training
and another TaskSurv during prediction.
PipeOpBreslow has one output channel named output
, producing NULL
during
training and a PredictionSurv during prediction.
State
The $state
slot stores the times
and status
survival target variables of
the train TaskSurv as well as the lp
predictions on the train set.
Parameters
The parameters are:
breslow.overwrite
::logical(1)
IfFALSE
(default) then the compositor does nothing and returns the inputlearner
's PredictionSurv. IfTRUE
or in the case that the inputlearner
doesn't havedistr
predictions, then thedistr
is overwritten with thedistr
composed fromlp
and the train set information using breslow. This is useful for changing the predictiondistr
from one model form to another.
See also
Other survival compositors:
mlr_pipeops_crankcompose
,
mlr_pipeops_distrcompose
,
mlr_pipeops_responsecompose
Super class
mlr3pipelines::PipeOp
-> PipeOpBreslow
Active bindings
learner
(mlr3::Learner)
The input survival learner.
Methods
Method new()
Creates a new instance of this R6 class.
Usage
PipeOpBreslow$new(learner, id = NULL, param_vals = list())
Arguments
learner
(LearnerSurv)
Survival learner which must providelp
-type predictionsid
(character(1))
Identifier of the resulting object. IfNULL
(default), it will be set as theid
of the inputlearner
.param_vals
(
list()
)
List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction.
Examples
if (FALSE) { # \dontrun{
if (requireNamespace("mlr3pipelines", quietly = TRUE)) {
library(mlr3)
library(mlr3pipelines)
task = tsk("rats")
part = partition(task, ratio = 0.8)
train_task = task$clone()$filter(part$train)
test_task = task$clone()$filter(part$test)
learner = lrn("surv.coxph") # learner with lp predictions
b = po("breslowcompose", learner = learner, breslow.overwrite = TRUE)
b$train(list(train_task))
p = b$predict(list(test_task))[[1L]]
}
} # }