Skip to contents

Uses a predicted distr in a PredictionSurv to estimate (or 'compose') a crank prediction.

Dictionary

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

Input and Output Channels

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.

State

The $state is left empty (list()).

Parameters

  • method :: character(1)
    Determines what method should be used to produce a continuous ranking from the distribution. One of sum_haz, 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). sum_haz (default) uses survivalmodels::surv_to_risk().

  • 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.

Internals

The median, mode, or mean will use analytical expressions if possible but if not they are calculated using methods from distr6. mean requires cubature.

See also

Super class

mlr3pipelines::PipeOp -> PipeOpCrankCompositor

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage

PipeOpCrankCompositor$new(
  id = "compose_crank",
  param_vals = list(method = "sum_haz", response = FALSE, overwrite = FALSE)
)

Arguments

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.


Method clone()

The objects of this class are cloneable with this method.

Usage

PipeOpCrankCompositor$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) {
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 = "sum_haz"))
  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 = "sum_haz"))
    poc$predict(list(learn))[[1]]
  }
}
}