mlr_learners_surv.cv_glmnet | R Documentation |
Generalized linear models with elastic net regularization.
Calls glmnet::cv.glmnet()
from package glmnet.
family
is set to "cox"
and cannot be changed.
This learner returns three prediction types:
lp
: a vector containing the linear predictors (relative risk scores),
where each score corresponds to a specific test observation.
Calculated using glmnet::predict.cv.glmnet()
.
crank
: same as lp
.
distr
: a survival matrix in two dimensions, where observations are
represented in rows and time points in columns.
Calculated using glmnet::survfit.cv.glmnet()
.
Parameters stype
and ctype
relate to how lp
predictions are transformed
into survival predictions and are described in survival::survfit.coxph()
.
By default the Breslow estimator is used for computing the baseline hazard.
This Learner can be instantiated via lrn():
lrn("surv.cv_glmnet")
Task type: “surv”
Predict Types: “crank”, “distr”, “lp”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3proba, mlr3extralearners, glmnet
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] |
|
exclude | untyped | - | - | |
exmx | numeric | 250 | (-\infty, \infty) |
|
fdev | numeric | 1e-05 | [0, 1] |
|
foldid | untyped | NULL | - | |
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) |
|
nfolds | integer | 10 | [3, \infty) |
|
nlambda | integer | 100 | [1, \infty) |
|
offset | untyped | NULL | - | |
newoffset | 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 | lambda.1se | [0, \infty) |
|
standardize | logical | TRUE | TRUE, FALSE | - |
standardize.response | logical | FALSE | TRUE, FALSE | - |
thresh | numeric | 1e-07 | [0, \infty) |
|
trace.it | integer | 0 | [0, 1] |
|
type.gaussian | character | - | covariance, naive | - |
type.logistic | character | Newton | Newton, modified.Newton | - |
type.measure | character | deviance | deviance, C | - |
type.multinomial | character | ungrouped | ungrouped, grouped | - |
upper.limits | untyped | Inf | - | |
stype | integer | 2 | [1, 2] |
|
ctype | integer | - | [1, 2] |
|
mlr3::Learner
-> mlr3proba::LearnerSurv
-> LearnerSurvCVGlmnet
new()
Creates a new instance of this R6 class.
LearnerSurvCVGlmnet$new()
selected_features()
Returns the set of selected features as reported by glmnet::predict.glmnet()
with type
set to "nonzero"
.
LearnerSurvCVGlmnet$selected_features(lambda = NULL)
lambda
(numeric(1)
)
Custom lambda
, defaults to the active lambda depending on parameter set.
(character()
) of feature names.
clone()
The objects of this class are cloneable with this method.
LearnerSurvCVGlmnet$clone(deep = FALSE)
deep
Whether to make a deep clone.
be-marc
Friedman J, Hastie T, Tibshirani R (2010). “Regularization Paths for Generalized Linear Models via Coordinate Descent.” Journal of Statistical Software, 33(1), 1–22. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v033.i01")}.
Dictionary of Learners: mlr3::mlr_learners.
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.
# Define the Learner
learner = mlr3::lrn("surv.cv_glmnet")
print(learner)
# 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)
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.