R: PipeOpCrankCompositor

mlr_pipeops_compose_crank {mlr3proba} | R Documentation

## PipeOpCrankCompositor

### Description

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

### Internals

The `median`, `mode`, or `mean` will use analytical expressions if possible but if not they are calculated using distr6::median.Distribution, distr6::mode, or distr6::mean.Distribution respectively. `mean` requires cubature.

### Super class

`mlr3pipelines::PipeOp` -> `PipeOpCrankCompositor`

### Methods

#### Public methods

- `PipeOpCrankCompositor$new()`

- `PipeOpCrankCompositor$clone()`

Inherited methods

- `mlr3pipelines::PipeOp$predict()`

- `mlr3pipelines::PipeOp$print()`

- `mlr3pipelines::PipeOp$train()`

#### Method `new()`

Creates a new instance of this R6 class.

##### Usage

    PipeOpCrankCompositor$new(
      id = "compose_crank",
      param_vals = list(method = "mean", 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.

### See Also

pipeline_crankcompositor

Other survival compositors: `mlr_pipeops_compose_distr`

### Examples

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

[Package mlr3proba version 0.3.2 Index]