dnnsurv | R Documentation |
DNNSurv neural fits a neural network based on pseudo-conditional survival probabilities.
dnnsurv(
formula = NULL,
data = NULL,
reverse = FALSE,
time_variable = "time",
status_variable = "status",
x = NULL,
y = NULL,
cutpoints = NULL,
cuts = 5L,
custom_model = NULL,
loss_weights = NULL,
weighted_metrics = NULL,
optimizer = "adam",
early_stopping = FALSE,
min_delta = 0,
patience = 0L,
verbose = 0L,
baseline = NULL,
restore_best_weights = FALSE,
batch_size = 32L,
epochs = 10L,
validation_split = 0,
shuffle = TRUE,
sample_weight = NULL,
initial_epoch = 0L,
steps_per_epoch = NULL,
validation_steps = NULL,
...
)
formula |
|
data |
|
reverse |
|
time_variable |
|
status_variable |
|
x |
|
y |
|
cutpoints |
|
cuts |
|
custom_model |
|
loss_weights , weighted_metrics |
See keras::compile.keras.engine.training.Model. |
optimizer |
|
early_stopping |
|
min_delta , patience , baseline , restore_best_weights |
See keras::callback_early_stopping. |
verbose |
|
batch_size , epochs , validation_split , shuffle , sample_weight , initial_epoch , steps_per_epoch , validation_steps |
See keras::fit.keras.engine.training.Model. # nolint |
... |
|
Code for generating the conditional probabilities and pre-processing data is taken from https://github.com/lilizhaoUM/DNNSurv.
An object of class survivalmodel
.
Zhao, L., & Feng, D. (2020). DNNSurv: Deep Neural Networks for Survival Analysis Using Pseudo Values. https://arxiv.org/abs/1908.02337
if (requireNamespaces(c("keras", "pseudo")))
# all defaults
dnnsurv(data = simsurvdata(10))
# setting common parameters
dnnsurv(time_variable = "time", status_variable = "status", data = simsurvdata(10),
early_stopping = TRUE, epochs = 100L, validation_split = 0.3)
# custom model
library(keras)
cuts <- 10
df <- simsurvdata(50)
# shape = features + cuts
input <- layer_input(shape = c(3L + cuts), name = 'input')
output <- input %>%
layer_dense(units = 4L, use_bias = TRUE) %>%
layer_dense(units = 1L, use_bias = TRUE ) %>%
layer_activation(activation="sigmoid")
model <- keras_model(input, output)
class(model)
dnnsurv(custom_model = model, time_variable = "time",
status_variable = "status", data = df, cuts = cuts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.