| mlr_pipeops_compose_crank {mlr3proba} | R Documentation |
Uses a predicted distr in a PredictionSurv to estimate (or 'compose') a crank prediction.
This PipeOp can be instantiated via the
dictionary mlr3pipelines::mlr_pipeops or with the associated sugar
function mlr3pipelines::po():
PipeOpCrankCompositor$new()
mlr_pipeops$get("crankcompose")
po("crankcompose")
PipeOpCrankCompositor has one input channel named "input", which takes
NULL during training and PredictionSurv during prediction.
PipeOpCrankCompositor has one output channel named "output", producing NULL during training
and a PredictionSurv during prediction.
The output during prediction is the PredictionSurv from the "pred" input but with the crank
predict type overwritten by the given estimation method.
The $state is left empty (list()).
method :: character(1)
Determines what method should be used to produce a continuous ranking from the distribution.
One of median, mode, or mean corresponding to the respective functions in the predicted
survival distribution. Note that for models with a proportional hazards form, the ranking
implied by mean and median will be identical (but not the value of crank itself).
Default is mean.
which :: numeric(1)
If method = "mode" then specifies which mode to use if multi-modal, default is the first.
response :: logical(1)
If TRUE then the response predict type is estimated with the same values as crank.
overwrite :: logical(1)
If FALSE (default) then if the "pred" input already has a crank, the compositor only
composes a response type if response = TRUE and does not already exist. If TRUE then
both the crank and response are overwritten.
The median, mode, or mean will use analytical expressions if possible but if not they are
calculated using methods from distr6. mean requires cubature.
mlr3pipelines::PipeOp -> PipeOpCrankCompositor
new()Creates a new instance of this R6 class.
PipeOpCrankCompositor$new( id = "compose_crank", param_vals = list(method = "mean", response = FALSE, overwrite = FALSE) )
id(character(1))
Identifier of the resulting object.
param_vals(list())
List of hyperparameter settings, overwriting the hyperparameter settings that would
otherwise be set during construction.
clone()The objects of this class are cloneable with this method.
PipeOpCrankCompositor$clone(deep = FALSE)
deepWhether to make a deep clone.
Other survival compositors:
mlr_pipeops_compose_distr
## Not run:
if (requireNamespace("mlr3pipelines", quietly = TRUE)) {
library(mlr3)
library(mlr3pipelines)
task = tsk("rats")
learn = lrn("surv.coxph")$train(task)$predict(task)
poc = po("crankcompose", param_vals = list(method = "median"))
poc$predict(list(learn))[[1]]
if (requireNamespace("cubature", quietly = TRUE)) {
learn = lrn("surv.coxph")$train(task)$predict(task)
poc = po("crankcompose", param_vals = list(method = "mean"))
poc$predict(list(learn))[[1]]
}
}
## End(Not run)