Skip to contents

This Learner specializes Learner for survival problems:

  • task_type is set to "surv"

  • Creates Predictions of class PredictionSurv.

  • Supported predict_types are:

    • "distr": A survival probability matrix, with rows corresponding to observations and columns to time points. Internally wrapped as a survDistr object for interpolation and transformation.

    • "lp": A numeric vector of predicted linear predictors (typically from proportional hazards models).

    • "crank": A numeric vector providing a continuous ranking of risk, where higher values correspond to higher risk.

    • "response": A numeric vector of predicted survival times, passed without modification.

Super class

mlr3::Learner -> LearnerSurv

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage

LearnerSurv$new(
  id,
  param_set = ps(),
  predict_types = "distr",
  feature_types = character(),
  properties = character(),
  packages = character(),
  label = NA_character_,
  man = NA_character_
)

Arguments

id

(character(1))
Identifier for the new instance.

param_set

(paradox::ParamSet)
Set of hyperparameters.

predict_types

(character())
Supported predict types. Must be a subset of mlr_reflections$learner_predict_types.

feature_types

(character())
Feature types the learner operates on. Must be a subset of mlr_reflections$task_feature_types.

properties

(character())
Set of properties of the Learner (see initialization method $new(). Must be a subset of mlr_reflections$learner_properties.

packages

(character())
Set of required packages. A warning is signaled by the constructor if at least one of the packages is not installed, but loaded (not attached) later on-demand via requireNamespace().

label

(character(1))
Label for the new instance.

man

(character(1))
String in the format [pkg]::[topic] pointing to a manual page for this object. The referenced help package can be opened via method $help().


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerSurv$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

library(mlr3)
# get all survival learners from mlr_learners:
lrns = mlr_learners$mget(mlr_learners$keys("^surv"))
names(lrns)
#> [1] "surv.coxph"  "surv.kaplan"

# get a specific learner from mlr_learners:
mlr_learners$get("surv.coxph")
#> 
#> ── <LearnerSurvCoxPH> (surv.coxph): Cox Proportional Hazards ───────────────────
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3, mlr3survival, and survival
#> • Predict Types: [crank], distr, and lp
#> • Feature Types: logical, integer, numeric, and factor
#> • Encapsulation: none (fallback: -)
#> • Properties: weights
#> • Other settings: use_weights = 'use'
lrn("surv.coxph")
#> 
#> ── <LearnerSurvCoxPH> (surv.coxph): Cox Proportional Hazards ───────────────────
#> • Model: -
#> • Parameters: list()
#> • Packages: mlr3, mlr3survival, and survival
#> • Predict Types: [crank], distr, and lp
#> • Feature Types: logical, integer, numeric, and factor
#> • Encapsulation: none (fallback: -)
#> • Properties: weights
#> • Other settings: use_weights = 'use'