From 6c9ff370f214a2af22301e622666ef6b5a3bddb0 Mon Sep 17 00:00:00 2001 From: Chirag Nagpal Date: Mon, 25 Oct 2021 12:33:47 -0400 Subject: [PATCH] new file: docs/contrib/dcm_api.html new file: docs/contrib/dcm_torch.html new file: docs/contrib/dcm_utilities.html new file: docs/contrib/index.html --- docs/contrib/dcm_api.html | 160 ++++++++++++++++++++++ docs/contrib/dcm_torch.html | 110 +++++++++++++++ docs/contrib/dcm_utilities.html | 235 ++++++++++++++++++++++++++++++++ docs/contrib/index.html | 108 +++++++++++++++ 4 files changed, 613 insertions(+) create mode 100644 docs/contrib/dcm_api.html create mode 100644 docs/contrib/dcm_torch.html create mode 100644 docs/contrib/dcm_utilities.html create mode 100644 docs/contrib/index.html diff --git a/docs/contrib/dcm_api.html b/docs/contrib/dcm_api.html new file mode 100644 index 0000000..a59a6d9 --- /dev/null +++ b/docs/contrib/dcm_api.html @@ -0,0 +1,160 @@ + + + + + + +dsm.contrib.dcm_api API documentation + + + + + + + + + + + + + +
+
+
+

Module dsm.contrib.dcm_api

+
+
+ +
+
+
+
+
+
+
+
+

Classes

+
+
+class DeepCoxMixtures +(k=3, layers=None, distribution='Weibull', temp=1000.0, discount=1.0) +
+
+

A Deep Cox Mixture model.

+

This is the main interface to a Deep Cox Mixture 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 Mixture, refer to the paper [1].

+

References

+

[1] Deep Cox Mixtures +for Survival Regression. Machine Learning in Health Conference (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.
+
+

Example

+
>>> from dsm.contrib import DeepCoxMixtures
+>>> model = DeepCoxMixtures()
+>>> 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', 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.
+
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_survival(self, x, t) +
+
+

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 .
+
t : list or float
+
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.
+
+ +
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/contrib/dcm_torch.html b/docs/contrib/dcm_torch.html new file mode 100644 index 0000000..8f6941d --- /dev/null +++ b/docs/contrib/dcm_torch.html @@ -0,0 +1,110 @@ + + + + + + +dsm.contrib.dcm_torch API documentation + + + + + + + + + + + + + +
+
+
+

Module dsm.contrib.dcm_torch

+
+
+ +
+
+
+
+
+
+
+
+

Classes

+
+
+class DeepCoxMixturesTorch +(inputdim, k, layers=None, optimizer='Adam') +
+
+

PyTorch model definition of the Deep Cox Mixture Survival Model.

+

The Cox Mixture involves the assumption that the survival function +of the individual to be a mixture of K Cox Models. Conditioned on each +subgroup Z=k; the PH assumptions are assumed to hold and the baseline +hazard rates is determined non-parametrically using an spline-interpolated +Breslow's estimator.

+

Initializes internal Module state, shared by both nn.Module and ScriptModule.

+ +

Class variables

+
+
var dump_patches : bool
+
+
+
+
var training : bool
+
+
+
+
+

Methods

+
+
+def forward(self, x) ‑> Callable[..., Any] +
+
+
+ +
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/contrib/dcm_utilities.html b/docs/contrib/dcm_utilities.html new file mode 100644 index 0000000..6f911ba --- /dev/null +++ b/docs/contrib/dcm_utilities.html @@ -0,0 +1,235 @@ + + + + + + +dsm.contrib.dcm_utilities API documentation + + + + + + + + + + + + + +
+
+
+

Module dsm.contrib.dcm_utilities

+
+
+ +
+
+
+
+
+
+

Functions

+
+
+def randargmax(b, **kw) +
+
+

a random tie-breaking argmax

+ +
+
+def partial_ll_loss(lrisks, tb, eb, eps=0.01) +
+
+
+ +
+
+def fit_spline(t, surv, s=0.0001) +
+
+
+ +
+
+def smooth_bl_survival(breslow, smoothing_factor) +
+
+
+ +
+
+def get_probability_(lrisks, ts, spl) +
+
+
+ +
+
+def get_survival_(lrisks, ts, spl) +
+
+
+ +
+
+def get_probability(lrisks, breslow_splines, t) +
+
+
+ +
+
+def get_survival(lrisks, breslow_splines, t) +
+
+
+ +
+
+def get_posteriors(probs) +
+
+
+ +
+
+def get_hard_z(gates_prob) +
+
+
+ +
+
+def sample_hard_z(gates_prob) +
+
+
+ +
+
+def repair_probs(probs) +
+
+
+ +
+
+def get_likelihood(model, breslow_splines, x, t, e, log=False) +
+
+
+ +
+
+def q_function(model, x, t, e, posteriors, typ='soft') +
+
+
+ +
+
+def e_step(model, breslow_splines, x, t, e, log=False) +
+
+
+ +
+
+def m_step(model, optimizer, x, t, e, posteriors, typ='soft') +
+
+
+ +
+
+def fit_breslow(model, x, t, e, posteriors=None, smoothing_factor=0.0001, typ='soft') +
+
+
+ +
+
+def train_step(model, x, t, e, breslow_splines, optimizer, bs=256, seed=100, typ='soft', use_posteriors=False, update_splines_after=10, smoothing_factor=0.0001) +
+
+
+ +
+
+def test_step(model, x, t, e, breslow_splines, loss='q', typ='soft') +
+
+
+ +
+
+def train_dcm(model, train_data, val_data, epochs=50, patience=3, vloss='q', bs=256, typ='soft', lr=0.001, use_posteriors=True, debug=False, random_state=0, return_losses=False, update_splines_after=10, smoothing_factor=0.0001) +
+
+
+ +
+
+def predict_survival(model, x, t) +
+
+
+ +
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/contrib/index.html b/docs/contrib/index.html new file mode 100644 index 0000000..d97ec0e --- /dev/null +++ b/docs/contrib/index.html @@ -0,0 +1,108 @@ + + + + + + +dsm.contrib API documentation + + + + + + + + + + + + + +
+
+
+

Module dsm.contrib

+
+
+

dsm includes extended functionality for survival analysis as part +of dsm.contrib.

+

Contributed Modules

+

This submodule incorporates contributed survival analysis methods.

+

Deep Cox Mixtures

+

The Cox Mixture involves the assumption that the survival function +of the individual to be a mixture of K Cox Models. Conditioned on each +subgroup Z=k; the PH assumptions are assumed to hold and the baseline +hazard rates is determined non-parametrically using an spline-interpolated +Breslow's estimator.

+

For full details on Deep Cox Mixture, refer to the paper [1].

+

References

+

[1] Deep Cox Mixtures +for Survival Regression. Machine Learning in Health Conference (2021)

+
  @article{nagpal2021dcm,
+  title={Deep Cox mixtures for survival regression},
+  author={Nagpal, Chirag and Yadlowsky, Steve and Rostamzadeh, Negar and Heller, Katherine},
+  journal={arXiv preprint arXiv:2101.06536},
+  year={2021}
+  }
+
+ +
+
+

Sub-modules

+
+
dsm.contrib.dcm_api
+
+
+
+
dsm.contrib.dcm_torch
+
+
+
+
dsm.contrib.dcm_utilities
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file