Cox Proportional Hazards Generalized Additive Learner
Source:R/learner_mgcv_surv_gam_cox.R
mlr_learners_surv.gam.cox.RdCox proportional hazards model fitted via generalized additive modeling.
Internally calls mgcv::gam() from the mgcv package with
family = mgcv::cox.ph(). The censoring indicator is passed via the
weights argument.
Prediction types
Three types of prediction are returned for this learner:
lp: a vector of linear predictors (relative risk scores), one per observation. Callsmgcv::predict.gam()withtype = "link".crank: same aslp.distr: a survival matrix in two dimensions, where observations are represented in rows and time points in columns. By default, the Breslow estimator is used viamlr3proba::breslow().
Meta Information
Task type: “surv”
Predict Types: “crank”, “distr”, “lp”
Feature Types: “logical”, “integer”, “numeric”, “factor”
Required Packages: mlr3, mlr3proba, mlr3extralearners, mgcv
Parameters
| Id | Type | Default | Levels | Range |
| formula | untyped | - | - | |
| method | character | GCV.Cp | GCV.Cp, GACV.Cp, REML, P-REML, ML, P-ML | - |
| optimizer | untyped | c("outer", "newton") | - | |
| scale | numeric | 0 | \((-\infty, \infty)\) | |
| select | logical | FALSE | TRUE, FALSE | - |
| knots | untyped | NULL | - | |
| sp | untyped | NULL | - | |
| min.sp | untyped | NULL | - | |
| H | untyped | NULL | - | |
| gamma | numeric | 1 | \([1, \infty)\) | |
| paraPen | untyped | NULL | - | |
| G | untyped | NULL | - | |
| in.out | untyped | NULL | - | |
| drop.unused.levels | logical | TRUE | TRUE, FALSE | - |
| drop.intercept | logical | FALSE | TRUE, FALSE | - |
| nei | untyped | - | - | |
| nthreads | integer | 1 | \([1, \infty)\) | |
| ncv.threads | integer | 1 | \([1, \infty)\) | |
| irls.reg | numeric | 0 | \([0, \infty)\) | |
| epsilon | numeric | 1e-07 | \([0, \infty)\) | |
| maxit | integer | 200 | \((-\infty, \infty)\) | |
| mgcv.tol | numeric | 1e-07 | \([0, \infty)\) | |
| mgcv.half | integer | 15 | \([0, \infty)\) | |
| trace | logical | FALSE | TRUE, FALSE | - |
| rank.tol | numeric | 1.490116e-08 | \([0, \infty)\) | |
| nlm | untyped | list() | - | |
| optim | untyped | list() | - | |
| newton | untyped | list() | - | |
| idLinksBases | logical | TRUE | TRUE, FALSE | - |
| scalePenalty | logical | TRUE | TRUE, FALSE | - |
| efs.lspmax | integer | 15 | \([0, \infty)\) | |
| efs.tol | numeric | 0.1 | \([0, \infty)\) | |
| scale.est | character | fletcher | fletcher, pearson, deviance | - |
| edge.correct | logical | FALSE | TRUE, FALSE | - |
| block.size | integer | 1000 | \((-\infty, \infty)\) | |
| unconditional | logical | FALSE | TRUE, FALSE | - |
Formula
A gam formula specific to the task at hand is required for the formula
parameter (see example and ?mgcv::formula.gam). Beware, if no formula is provided, a fallback formula is
used that will make the gam behave like a glm (this behavior is required
for the unit tests). Only features specified in the formula will be used,
superseding columns with col_roles "feature" in the task.
Offset
If a Task contains a column with the offset role, it is automatically
incorporated during training via the offset argument in mgcv::gam().
No offset is applied during prediction for this learner.
References
Wood, Simon (2012). “mgcv: Mixed GAM Computation Vehicle with GCV/AIC/REML smoothness estimation.”
Wood, N. S, Pya, Natalya, Safken, Benjamin (2016). “Smoothing Parameter and Model Selection for General Smooth Models.” Journal of the American Statistical Association, 111(516), 1548–1563. doi:10.1080/01621459.2016.1180986 .
Super classes
mlr3::Learner -> mlr3proba::LearnerSurv -> LearnerSurvGamCox
Examples
# simple example
t = tsk("lung")
l = lrn("surv.gam.cox")
l$param_set$set_values(formula = time ~ s(age, k = 5) + ph.karno + sex)
l$train(t)
l$model
#>
#> Family: Cox PH
#> Link function: identity
#>
#> Formula:
#> time ~ s(age, k = 5) + ph.karno + sex
#>
#> Estimated degrees of freedom:
#> 1 total = 3
#>
#> REML score: 513.9053