Module auton_survival.models.cph
Deep Cox Proportional Hazards Model
Submodules
auton_survival.models.cph.dcph_torch
auton_survival.models.cph.dcph_utilities
Classes
class DeepCoxPH (layers=None, random_seed=0)

A Deep Cox Proportional Hazards model.
This is the main interface to a Deep Cox Proportional Hazards model. A model is instantiated with approporiate set of hyperparameters and fit on numpy arrays consisting of the features, event/censoring times and the event/censoring indicators.
For full details on Deep Cox Proportional Hazards, refer [1], [2].
References
[2] A neural network model for survival data. Statistics in medicine (1995)
Parameters
k
:int
 The number of underlying Cox distributions.
layers
:list
 A list of integers consisting of the number of neurons in each hidden layer.
random_seed
:int
 Controls the reproducibility of called functions.
Example
>>> from auton_survival import DeepCoxPH >>> model = DeepCoxPH() >>> model.fit(x, t, e)
Methods
def fit(self, x, t, e, vsize=0.15, val_data=None, iters=1, learning_rate=0.001, batch_size=100, optimizer='Adam')

This method is used to train an instance of the DSM model.
Parameters
x
:np.ndarray
 A numpy array of the input features, x .
t
:np.ndarray
 A numpy array of the event/censoring times, t .
e
:np.ndarray
 A numpy array of the event/censoring indicators, \delta . \delta = 1 means the event took place.
vsize
:float
 Amount of data to set aside as the validation set.
val_data
:tuple
 A tuple of the validation dataset. If passed vsize is ignored.
iters
:int
 The maximum number of training iterations on the training dataset.
learning_rate
:float
 The learning rate for the
Adam
optimizer. batch_size
:int
 learning is performed on minibatches of input data. this parameter specifies the size of each minibatch.
optimizer
:str
 The choice of the gradient based optimization method. One of 'Adam', 'RMSProp' or 'SGD'.
def predict_risk(self, x, t=None)
def predict_survival(self, x, t=None)

Returns the estimated survival probability at time t , \widehat{\mathbb{P}}(T > tX) for some input data x .
Parameters
x
:np.ndarray
 A numpy array of the input features, x .
t
:list
orfloat
 a list or float of the times at which survival probability is to be computed
Returns
np.array
 numpy array of the survival probabilites at each time in t.
class DeepRecurrentCoxPH (layers=None, hidden=None, typ='LSTM', random_seed=0)

A deep recurrent Cox PH model.
This model is based on the paper: Leveraging Deep Representations of Radiology Reports in Survival Analysis for Predicting Heart Failure Patient Mortality. NAACL (2021)
Parameters
k
:int
 The number of underlying Cox distributions.
layers
:list
 A list of integers consisting of the number of neurons in each hidden layer.
random_seed
:int
Controls the reproducibility of called functions. Example
>>> from dsm.contrib import DeepRecurrentCoxPH >>> model = DeepRecurrentCoxPH() >>> model.fit(x, t, e)
Methods
def fit(self, x, t, e, vsize=0.15, val_data=None, iters=1, learning_rate=0.001, batch_size=100, optimizer='Adam')

This method is used to train an instance of the DSM model.
Parameters
x
:np.ndarray
 A numpy array of the input features, x .
t
:np.ndarray
 A numpy array of the event/censoring times, t .
e
:np.ndarray
 A numpy array of the event/censoring indicators, \delta . \delta = 1 means the event took place.
vsize
:float
 Amount of data to set aside as the validation set.
val_data
:tuple
 A tuple of the validation dataset. If passed vsize is ignored.
iters
:int
 The maximum number of training iterations on the training dataset.
learning_rate
:float
 The learning rate for the
Adam
optimizer. batch_size
:int
 learning is performed on minibatches of input data. this parameter specifies the size of each minibatch.
optimizer
:str
 The choice of the gradient based optimization method. One of 'Adam', 'RMSProp' or 'SGD'.
def predict_survival(self, x, t=None)

Inherited from:
DeepCoxPH
.predict_survival
Returns the estimated survival probability at time t , \widehat{\mathbb{P}}(T > tX) for some input data x .
Parameters
x
:np.ndarray
 A numpy array of the input features, x .
t
:list
orfloat
 a list or float of the times at which survival probability is to be computed
Returns
np.array
 numpy array of the survival probabilites at each time in t.