Skip to contents

Penalized (L1 and L2) Cox Proportional Hazards model. Calls penalized::penalized() from penalized.

Details

The penalized and unpenalized arguments in the learner are implemented slightly differently than in penalized::penalized(). Here, there is no parameter for penalized but instead it is assumed that every variable is penalized unless stated in the unpenalized parameter.

Prediction types

This learner returns two prediction types:

  1. distr: a survival matrix in two dimensions, where observations are represented in rows and time points in columns. Calculated using the internal penalized::predict() function. By default the Breslow estimator penalized::breslow() is used for computing the baseline hazard.

  2. crank: the expected mortality using mlr3proba::.surv_return().

Initial parameter values

  • trace is set to "FALSE" to disable printing output during model training.

Dictionary

This Learner can be instantiated via lrn():

lrn("surv.penalized")

Meta Information

Parameters

IdTypeDefaultLevelsRange
unpenalizeduntyped--
lambda1untyped0-
lambda2untyped0-
positivelogicalFALSETRUE, FALSE-
fusedllogicalFALSETRUE, FALSE-
startbetanumeric-\((-\infty, \infty)\)
startgammanumeric-\((-\infty, \infty)\)
stepsinteger1\([1, \infty)\)
epsilonnumeric1e-10\([0, 1]\)
maxiterinteger-\([1, \infty)\)
standardizelogicalFALSETRUE, FALSE-
tracelogicalTRUETRUE, FALSE-

References

Goeman, J J (2010). “L1 penalized estimation in the Cox proportional hazards model.” Biometrical journal, 52(1), 70–84.

See also

Author

RaphaelS1

Super classes

mlr3::Learner -> mlr3proba::LearnerSurv -> LearnerSurvPenalized

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


Method selected_features()

Selected features are extracted with the method coef() of the S4 model object, see penalized::penfit(). By default it returns features with non-zero coefficients.

Note: Selected features can be retrieved only for datasets with numeric features, as the presence of factors with multiple levels makes it difficult to get the original feature names.

Usage

LearnerSurvPenalized$selected_features()

Returns

character().


Method clone()

The objects of this class are cloneable with this method.

Usage

LearnerSurvPenalized$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# Define the Learner
learner = mlr3::lrn("surv.penalized")
print(learner)
#> <LearnerSurvPenalized:surv.penalized>: Penalized Regression
#> * Model: -
#> * Parameters: trace=FALSE
#> * Packages: mlr3, mlr3proba, mlr3extralearners, penalized, pracma
#> * Predict Types:  [crank], distr
#> * Feature Types: logical, integer, numeric, factor
#> * Properties: -

# Define a Task
task = mlr3::tsk("grace")

# Create train and test set
ids = mlr3::partition(task)

# Train the learner on the training ids
learner$train(task, row_ids = ids$train)

print(learner$model)
#> $model
#> Penalized cox regression object
#> 6 regression coefficients
#> 
#> Loglikelihood =	 -1324.814 
#> 
#> $task_has_factors
#> [1] FALSE
#> 


# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)

# Score the predictions
predictions$score()
#> surv.cindex 
#>    0.829731