deepSurv {dnn} | R Documentation |
Deep learning for the Cox proportional hazards model
Description
Fit a survival regression model under the Cox proportional hazards assumption using deep learning neural network (DNN).
Usage
deepSurv(formula, model, data, epochs = 200, lr_rate = 1e-04,
batch_size = 64, alpha = 0.7, lambda = 1, verbose = 0,
weights = NULL, ...)
Arguments
formula |
a formula expression as for other regression models. The response is usually a survival object as returned by the 'Surv' function. See the documentation for 'Surv', 'lm' and 'formula' for details. |
model |
a deep neural network model, created by function dNNmodel(). |
data |
a data.frame in which to interpret the variables named in the formula. |
epochs |
number of deep learning epochs, default is 200. |
batch_size |
batch size, default is 64. 'NaN' may be generated if batch size is too small and there is not event in a batch. |
lr_rate |
learning rate for the gradient descent algorithm, default is lr_rate = 1e-04. |
weights |
an optional vector of 'prior weights' to be used in the fitting process. Should be NULL or a numeric vector. |
alpha |
momentum rate for the gradient descent method, alpha takes value in [0, 1), default is alpha = 0.70. |
lambda |
L2 regularization parameter for deep learning. |
verbose |
verbose = 1 for print out verbose during the model fit, 0 for not print. |
... |
optional arguments |
Details
See "Deep learning with R" for details on how to build a deep learning model.
The following parameters in 'dnnControl' will be used to control the model fit process.
'epochs': number of deep learning epochs, default is 30.
'verbose': verbose = 1 for print out verbose during the model fit, 0 for not print.
'epsilon': epsilon for convergence check, default is epsilon = 0.001.
'max.iter': number of maximum iteration, default is max.iter = 30.
When the variance for covariance matrix X is too large, please use xbar = scale(x) to standardize X.
Value
An object of class "deepSurv" is returned. The deepSurv object contains the following list components:
x |
Covariates for Cox model |
y |
Surv object for Cox model |
model |
dnn model |
predictor |
predictor score mu = f(x) |
risk |
risk score = exp(predictor) |
Note
For right censored survival time only
Author(s)
Chen, B. E. wrote the R code using the partial likelihood cost function proposed by Katzman et al (2018).
References
Katzman JL, Shaham U, Cloninger A, Bates J, Jiang T, Kluger Y. DeepSurv: Personalized treatment recommender system using a Cox proportional hazards deep neural network. BMC Medical Research Methodology 2018; 18: 24.
See Also
deepAFT
, deepGlm
,
print.deepSurv
, survreg
Examples
## Example for deep learning proportional hazards survival model
set.seed(101)
### define model layers
model = dNNmodel(units = c(4, 3, 1), activation = c("elu", "sigmoid", "sigmoid"),
input_shape = 3)
x = matrix(runif(15), nrow = 5, ncol = 3)
time = exp(x[, 1])
status = c(1, 0, 1, 1, 1)
fit = deepSurv(Surv(time, status) ~ x, model = model)