From 8880249bb83319f1c9a10a4ccdf17ad7f95af19f Mon Sep 17 00:00:00 2001 From: Chirag Nagpal Date: Sun, 3 Jan 2021 04:49:30 +0530 Subject: [PATCH] modified: docs/dsm_api.html modified: docs/dsm_torch.html modified: docs/losses.html --- docs/dsm_api.html | 88 +++++++++++++++++++++++++++----- docs/dsm_torch.html | 119 +++++++++++++++++++++++++++++++++++++++++--- docs/losses.html | 13 +++-- 3 files changed, 198 insertions(+), 22 deletions(-) diff --git a/docs/dsm_api.html b/docs/dsm_api.html index 97ff813..108bc33 100644 --- a/docs/dsm_api.html +++ b/docs/dsm_api.html @@ -115,8 +115,28 @@

Parameters

random seed that determines how the validation set is chosen.
+
+def predict_mean(self, x, risk=1) +
+
+

+Inherited from: +DSMBase.predict_mean +

+

Returns the mean Time-to-Event t

+

Parameters

+
+
x : np.ndarray
+
A numpy array of the input features, x .
+
+

Returns

+
+
np.array
+
numpy array of the mean time to event.
+
+
-def predict_risk(self, x, t) +def predict_risk(self, x, t, risk=1)

@@ -140,7 +160,7 @@

Returns

-def predict_survival(self, x, t) +def predict_survival(self, x, t, risk=1)

@@ -211,8 +231,28 @@

Parameters

random seed that determines how the validation set is chosen.
+
+def predict_mean(self, x, risk=1) +
+
+

+Inherited from: +DSMBase.predict_mean +

+

Returns the mean Time-to-Event t

+

Parameters

+
+
x : np.ndarray
+
A numpy array of the input features, x .
+
+

Returns

+
+
np.array
+
numpy array of the mean time to event.
+
+
-def predict_risk(self, x, t) +def predict_risk(self, x, t, risk=1)

@@ -236,7 +276,7 @@

Returns

-def predict_survival(self, x, t) +def predict_survival(self, x, t, risk=1)

@@ -263,12 +303,11 @@

Returns

class DeepConvolutionalSurvivalMachines -(k=3, layers=None, hidden=None, distribution='Weibull', temp=1000.0, discount=1.0, typ='LSTM') +(k=3, layers=None, hidden=None, distribution='Weibull', temp=1000.0, discount=1.0, typ='ConvNet')
-
-

Warning: Not Implemented

-
+

The Deep Convolutional Survival Machines model to handle data with +image-based covariates.

Methods

@@ -277,7 +316,7 @@

Methods

Inherited from: -DeepRecurrentSurvivalMachines.fit +DSMBase.fit

This method is used to train an instance of the DSM model.

Parameters

@@ -308,13 +347,33 @@

Parameters

random seed that determines how the validation set is chosen.
+
+def predict_mean(self, x, risk=1) +
+
+

+Inherited from: +DSMBase.predict_mean +

+

Returns the mean Time-to-Event t

+

Parameters

+
+
x : np.ndarray
+
A numpy array of the input features, x .
+
+

Returns

+
+
np.array
+
numpy array of the mean time to event.
+
+
-def predict_risk(self, x, t) +def predict_risk(self, x, t, risk=1)

Inherited from: -DeepRecurrentSurvivalMachines.predict_risk +DSMBase.predict_risk

Returns the estimated risk of an event occuring before time t \widehat{\mathbb{P}}(T\leq t|X) for some input data x .

@@ -333,12 +392,12 @@

Returns

-def predict_survival(self, x, t) +def predict_survival(self, x, t, risk=1)

Inherited from: -DeepRecurrentSurvivalMachines.predict_survival +DSMBase.predict_survival

Returns the estimated survival probability at time t , \widehat{\mathbb{P}}(T > t|X) for some input data x .

@@ -378,6 +437,7 @@

Index

DeepSurvivalMachines

@@ -386,6 +446,7 @@

DeepRecurrentSurvivalMachines

@@ -394,6 +455,7 @@

DeepConvolutionalSurvivalMachines

diff --git a/docs/dsm_torch.html b/docs/dsm_torch.html index 5133bf4..c2c66a5 100644 --- a/docs/dsm_torch.html +++ b/docs/dsm_torch.html @@ -61,6 +61,31 @@

Parameters

Returns

an MLP with torch.nn.Module with the specfied structure.

+
+def create_conv_representation(inputdim, hidden, typ='ConvNet') +
+
+

Helper function to generate the representation function for DSM.

+

Deep Survival Machines learns a representation (\ Phi(X) ) for the input +data. This representation is parameterized using a Convolutional Neural +Network (torch.nn.Module). This is a helper function designed to +instantiate the representation for Deep Survival Machines.

+
+

Warning

+

Not designed to be used directly.

+
+

Parameters

+
+
inputdim : int
+
Dimensionality of the input features.
+
hidden : int
+
The number of neurons in each hidden layer.
+
typ : str
+
Choice of convolutional neural network: One of 'ConvNet'
+
+

Returns

+

an ConvNet with torch.nn.Module with the specfied structure.

+
@@ -68,7 +93,7 @@

Classes

class DeepSurvivalMachinesTorch -(inputdim, k, layers=None, dist='Weibull', temp=1000.0, discount=1.0, optimizer='Adam') +(inputdim, k, layers=None, dist='Weibull', temp=1000.0, discount=1.0, optimizer='Adam', risks=1)

A Torch implementation of Deep Survival Machines model.

@@ -115,7 +140,7 @@

Parameters

Methods

-def forward(self, x) ‑> Callable[..., Any] +def forward(self, x, risk='1') ‑> Callable[..., Any]

The forward function that is called when data is passed through DSM.

@@ -124,7 +149,7 @@

Args

a torch.tensor of the input features.

-def get_shape_scale(self) +def get_shape_scale(self, risk='1')
@@ -133,7 +158,7 @@

Args

class DeepRecurrentSurvivalMachinesTorch -(inputdim, k, typ='LSTM', layers=1, hidden=None, dist='Weibull', temp=1000.0, discount=1.0, optimizer='Adam') +(inputdim, k, typ='LSTM', layers=1, hidden=None, dist='Weibull', temp=1000.0, discount=1.0, optimizer='Adam', risks=1)

A Torch implementation of Deep Recurrent Survival Machines model.

@@ -177,7 +202,7 @@

Parameters

Methods

-def forward(self, x) ‑> Callable[..., Any] +def forward(self, x, risk='1') ‑> Callable[..., Any]

The forward function that is called when data is passed through DSM.

@@ -189,7 +214,79 @@

Args

a torch.tensor of the input features.

-def get_shape_scale(self) +def get_shape_scale(self, risk='1') +
+
+
+
+
+
+
+class DeepConvolutionalSurvivalMachinesTorch +(inputdim, k, typ='ConvNet', hidden=None, dist='Weibull', temp=1000.0, discount=1.0, optimizer='Adam', risks=1) +
+
+

A Torch implementation of Deep Convolutional Survival Machines model.

+

This is an implementation of Deep Convolutional Survival Machines model +in torch. It inherits from DeepSurvivalMachinesTorch and replaces the +input representation learning MLP with an simple convnet, the parameters of +the underlying distributions and the forward function which is called whenever +data is passed to the module. Each of the parameters are nn.Parameters and +torch automatically keeps track and computes gradients for them.

+
+

Warning

+

Not designed to be used directly. +Please use the API inferface +DeepConvolutionalSurvivalMachines!!

+
+

Parameters

+
+
inputdim : int
+
Dimensionality of the input features. A tuple (height, width).
+
k : int
+
The number of underlying parametric distributions.
+
hidden : int
+
The number of neurons in each hidden layer.
+
init : tuple
+
A tuple for initialization of the parameters for the underlying +distributions. (shape, scale).
+
dist : str
+
Choice of the underlying survival distributions. +One of 'Weibull', 'LogNormal'. +Default is 'Weibull'.
+
temp : float
+
The logits for the gate are rescaled with this value. +Default is 1000.
+
discount : float
+
a float in [0,1] that determines how to discount the tail bias +from the uncensored instances. +Default is 1.
+
+

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, risk='1') ‑> Callable[..., Any] +
+
+

The forward function that is called when data is passed through DSM.

+

Args

+

x: +a torch.tensor of the input features.

+
+
+def get_shape_scale(self, risk='1')
@@ -213,6 +310,7 @@

Index

  • Functions

  • Classes

    @@ -231,6 +329,15 @@

    get_shape_scale

  • +
  • +

    DeepConvolutionalSurvivalMachinesTorch

    + +
  • diff --git a/docs/losses.html b/docs/losses.html index 422db53..7446e9b 100644 --- a/docs/losses.html +++ b/docs/losses.html @@ -44,19 +44,25 @@

    Module dsm.losses

    Functions

    -def unconditional_loss(model, t, e) +def unconditional_loss(model, t, e, risk='1')
    -def conditional_loss(model, x, t, e, elbo=True) +def conditional_loss(model, x, t, e, elbo=True, risk='1') +
    +
    +
    +
    +
    +def predict_mean(model, x, risk='1')
    -def predict_cdf(model, x, t_horizon) +def predict_cdf(model, x, t_horizon, risk='1')
    @@ -81,6 +87,7 @@

    Index