Module auton_survival.models.cmhe.cmhe_api
-Classes
--
-
-class DeepCoxMixturesHeterogenousEffects -(k, g, layers=None) -
--
-- -
A Deep Cox Mixtures with Heterogenous Effects model.
-This is the main interface to a Deep Cox Mixture with Heterogenous Effects. -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 Mixture, refer to the paper [1].
-References
-[1] Nagpal, C., Goswami M., Dufendach K., and Artur Dubrawski. -"Counterfactual phenotyping for censored Time-to-Events" (2022).
-Parameters
--
-
k
:int
-- The number of underlying base survival phenotypes. -
g
:int
-- The number of underlying treatment effect phenotypes. -
layers
:list
-- A list of integers consisting of the number of neurons in each -hidden layer. -
Example
->>> from auton_survival import DeepCoxMixturesHeterogenousEffects ->>> model = DeepCoxMixturesHeterogenousEffects(k=2, g=3) ->>> model.fit(x, t, e, a) -
Methods
--
-
-def fit(self, x, t, e, a, vsize=0.15, val_data=None, iters=1, learning_rate=0.001, batch_size=100, optimizer='Adam', random_state=100) -
--
-- -
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. -
a
:np.ndarray
-- A numpy array of the treatment assignment indicators, a . - a = 1 means the individual was treated. -
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 mini-batches of input data. this parameter -specifies the size of each mini-batch. -
optimizer
:str
-- The choice of the gradient based optimization method. One of -'Adam', 'RMSProp' or 'SGD'. -
random_state
:float
-- random seed that determines how the validation set is chosen. -
- -def predict_risk(self, x, a, t=None) -
-- - - - -
-def predict_survival(self, x, a, t=None) -
--
-- -
Returns the estimated survival probability at time t , - \widehat{\mathbb{P}}(T > t|X) for some input data x .
-Parameters
--
-
x
:np.ndarray
-- A numpy array of the input features, x . -
a
:np.ndarray
-- A numpy array of the treatmeant assignment, a . -
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. -
- -def predict_latent_z(self, x) -
--
-- -
Returns the estimated latent base survival group z given the confounders x .
- -def predict_latent_phi(self, x) -
--
-- -
Returns the estimated latent treatment effect group \phi given the confounders x .
-
-