GLM with Elastic Net Regularization Survival Learner
mlr_learners_surv.glmnet.Rd
Generalized linear models with elastic net regularization.
Calls glmnet::glmnet()
from package glmnet.
family
is set to"cox"
and cannot be changed.
Details
This learner returns two prediction types:
lp
: a vector of linear predictors (relative risk scores), one per observation. Calculated usingglmnet::predict.coxnet()
.distr
: a survival matrix in two dimensions, where observations are represented in rows and time points in columns. Calculated usingglmnet::survfit.coxnet()
. Parametersstype
andctype
relate to howlp
predictions are transformed into survival predictions and are described insurvival::survfit.coxph()
. By default the Breslow estimator is used.
Caution: This learner is different to learners calling glmnet::cv.glmnet()
in that it does not use the internal optimization of parameter lambda
.
Instead, lambda
needs to be tuned by the user (e.g., via mlr3tuning).
When lambda
is tuned, the glmnet
will be trained for each tuning iteration.
While fitting the whole path of lambda
s would be more efficient, as is done
by default in glmnet::glmnet()
, tuning/selecting the parameter at prediction time
(using parameter s
) is currently not supported in mlr3
(at least not in efficient manner).
Tuning the s
parameter is, therefore, currently discouraged.
When the data are i.i.d. and efficiency is key, we recommend using the respective
auto-tuning counterpart in mlr_learners_surv.cv_glmnet()
.
However, in some situations this is not applicable, usually when data are
imbalanced or not i.i.d. (longitudinal, time-series) and tuning requires
custom resampling strategies (blocked design, stratification).
Dictionary
This Learner can be instantiated via the dictionary mlr_learners or with the associated sugar function lrn()
:
$get("surv.glmnet")
mlr_learnerslrn("surv.glmnet")
Meta Information
Task type: “surv”
Predict Types: “crank”, “distr”, “lp”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3proba, mlr3extralearners, glmnet
Parameters
Id | Type | Default | Levels | Range |
alignment | character | lambda | lambda, fraction | - |
alpha | numeric | 1 | \([0, 1]\) | |
big | numeric | 9.9e+35 | \((-\infty, \infty)\) | |
devmax | numeric | 0.999 | \([0, 1]\) | |
dfmax | integer | - | \([0, \infty)\) | |
eps | numeric | 1e-06 | \([0, 1]\) | |
epsnr | numeric | 1e-08 | \([0, 1]\) | |
exact | logical | FALSE | TRUE, FALSE | - |
exclude | untyped | - | - | |
exmx | numeric | 250 | \((-\infty, \infty)\) | |
fdev | numeric | 1e-05 | \([0, 1]\) | |
gamma | untyped | - | - | |
grouped | logical | TRUE | TRUE, FALSE | - |
intercept | logical | TRUE | TRUE, FALSE | - |
keep | logical | FALSE | TRUE, FALSE | - |
lambda | untyped | - | - | |
lambda.min.ratio | numeric | - | \([0, 1]\) | |
lower.limits | untyped | - , Inf | - | |
maxit | integer | 100000 | \([1, \infty)\) | |
mnlam | integer | 5 | \([1, \infty)\) | |
mxit | integer | 100 | \([1, \infty)\) | |
mxitnr | integer | 25 | \([1, \infty)\) | |
newoffset | untyped | - | - | |
nlambda | integer | 100 | \([1, \infty)\) | |
offset | untyped | - | ||
parallel | logical | FALSE | TRUE, FALSE | - |
penalty.factor | untyped | - | - | |
pmax | integer | - | \([0, \infty)\) | |
pmin | numeric | 1e-09 | \([0, 1]\) | |
prec | numeric | 1e-10 | \((-\infty, \infty)\) | |
predict.gamma | numeric | gamma.1se | \((-\infty, \infty)\) | |
relax | logical | FALSE | TRUE, FALSE | - |
s | numeric | 0.01 | \([0, \infty)\) | |
standardize | logical | TRUE | TRUE, FALSE | - |
thresh | numeric | 1e-07 | \([0, \infty)\) | |
trace.it | integer | 0 | \([0, 1]\) | |
type.logistic | character | Newton | Newton, modified.Newton | - |
type.multinomial | character | ungrouped | ungrouped, grouped | - |
upper.limits | untyped | Inf | - | |
stype | integer | 2 | \([1, 2]\) | |
ctype | integer | - | \([1, 2]\) |
References
Friedman J, Hastie T, Tibshirani R (2010). “Regularization Paths for Generalized Linear Models via Coordinate Descent.” Journal of Statistical Software, 33(1), 1--22. doi:10.18637/jss.v033.i01 .
See also
as.data.table(mlr_learners)
for a table of available Learners in the running session (depending on the loaded packages).Chapter in the mlr3book: https://mlr3book.mlr-org.com/basics.html#learners
mlr3learners for a selection of recommended learners.
mlr3cluster for unsupervised clustering learners.
mlr3pipelines to combine learners with pre- and postprocessing steps.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Super classes
mlr3::Learner
-> mlr3proba::LearnerSurv
-> LearnerSurvGlmnet
Methods
Method selected_features()
Returns the set of selected features as reported by glmnet::predict.glmnet()
with type
set to "nonzero"
.
Arguments
lambda
(
numeric(1)
)
Customlambda
, defaults to the active lambda depending on parameter set.
Returns
(character()
) of feature names.
Examples
learner = mlr3::lrn("surv.glmnet")
print(learner)
#> <LearnerSurvGlmnet:surv.glmnet>: Regularized Generalized Linear Model
#> * Model: -
#> * Parameters: list()
#> * Packages: mlr3, mlr3proba, mlr3extralearners, glmnet
#> * Predict Types: [crank], distr, lp
#> * Feature Types: logical, integer, numeric
#> * Properties: selected_features, weights
# available parameters:
learner$param_set$ids()
#> [1] "alignment" "alpha" "big" "devmax"
#> [5] "dfmax" "eps" "epsnr" "exact"
#> [9] "exclude" "exmx" "fdev" "gamma"
#> [13] "grouped" "intercept" "keep" "lambda"
#> [17] "lambda.min.ratio" "lower.limits" "maxit" "mnlam"
#> [21] "mxit" "mxitnr" "newoffset" "nlambda"
#> [25] "offset" "parallel" "penalty.factor" "pmax"
#> [29] "pmin" "prec" "predict.gamma" "relax"
#> [33] "s" "standardize" "thresh" "trace.it"
#> [37] "type.logistic" "type.multinomial" "upper.limits" "stype"
#> [41] "ctype"