coxtime {survivalmodels}R Documentation

Cox-Time Survival Neural Network

Description

Cox-Time fits a neural network based on the Cox PH with possibly time-dependent effects.

Usage

coxtime(
  formula = NULL,
  data = NULL,
  reverse = FALSE,
  time_variable = "time",
  status_variable = "status",
  x = NULL,
  y = NULL,
  frac = 0,
  standardize_time = FALSE,
  log_duration = FALSE,
  with_mean = TRUE,
  with_std = TRUE,
  activation = "relu",
  num_nodes = c(32L, 32L),
  batch_norm = TRUE,
  dropout = NULL,
  device = NULL,
  shrink = 0,
  early_stopping = FALSE,
  best_weights = FALSE,
  min_delta = 0,
  patience = 10L,
  batch_size = 256L,
  epochs = 1L,
  verbose = FALSE,
  num_workers = 0L,
  shuffle = TRUE,
  ...
)

Arguments

formula

(formula(1))
Object specifying the model fit, left-hand-side of formula should describe a survival::Surv() object.

data

(data.frame(1))
Training data of data.frame like object, internally is coerced with stats::model.matrix().

reverse

(logical(1))
If TRUE fits estimator on censoring distribution, otherwise (default) survival distribution.

time_variable

(character(1))
Alternative method to call the function. Name of the 'time' variable, required if formula. or x and Y not given.

status_variable

(character(1))
Alternative method to call the function. Name of the 'status' variable, required if formula or x and Y not given.

x

(data.frame(1))
Alternative method to call the function. Required if ⁠formula, time_variable⁠ and status_variable not given. Data frame like object of features which is internally coerced with model.matrix.

y

⁠([survival::Surv()])⁠
Alternative method to call the function. Required if ⁠formula, time_variable⁠ and status_variable not given. Survival outcome of right-censored observations.

frac

(numeric(1))
Fraction of data to use for validation dataset, default is 0 and therefore no separate validation dataset.

standardize_time

(logical(1))
If TRUE, the time outcome is standardized.

log_duration

(logical(1))
If TRUE and standardize_time is TRUE then time variable is log transformed.

with_mean

(logical(1))
If TRUE (default) and standardize_time is TRUE then time variable is centered.

with_std

(logical(1))
If TRUE (default) and standardize_time is TRUE then time variable is scaled to unit variance.

activation

(character(1))
See get_pycox_activation.

num_nodes, batch_norm, dropout

(integer()/logical(1)/numeric(1))
See build_pytorch_net.

device

(integer(1)|character(1))
Passed to pycox.models.Coxtime, specifies device to compute models on.

shrink

(numeric(1))
Passed to pycox.models.Coxtime, shrinkage parameter for regularization.

early_stopping, best_weights, min_delta, patience

⁠(logical(1)/logical(1)/numeric(1)/integer(1)⁠
See get_pycox_callbacks.

batch_size

(integer(1))
Passed to pycox.models.Coxtime.fit, elements in each batch.

epochs

(integer(1))
Passed to pycox.models.Coxtime.fit, number of epochs.

verbose

(logical(1))
Passed to pycox.models.Coxtime.fit, should information be displayed during fitting.

num_workers

(integer(1))
Passed to pycox.models.Coxtime.fit, number of workers used in the dataloader.

shuffle

(logical(1))
Passed to pycox.models.Coxtime.fit, should order of dataset be shuffled?

...

ANY
Passed to get_pycox_optim.

Details

Implemented from the pycox Python package via reticulate. Calls pycox.models.Coxtime.

Value

An object inheriting from class coxtime.

An object of class survivalmodel.

References

Kvamme, H., Borgan, Ø., & Scheel, I. (2019). Time-to-event prediction with neural networks and Cox regression. Journal of Machine Learning Research, 20(129), 1–30.


[Package survivalmodels version 0.1.191 Index]