Skip to content

Commit

Permalink
modified: dcm_utilities.py
Browse files Browse the repository at this point in the history
  • Loading branch information
chiragnagpal committed Dec 24, 2021
1 parent 66bae40 commit e03a4a4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dsm/contrib/dcm_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_probability_(lrisks, ts, spl):
def get_survival_(lrisks, ts, spl):
risks = np.exp(lrisks)
return spl(ts)**risks

def get_probability(lrisks, breslow_splines, t):
psurv = []
for i in range(lrisks.shape[1]):
Expand Down Expand Up @@ -125,13 +125,13 @@ def q_function(model, x, t, e, posteriors, typ='soft'):
#log_smax_loss = -torch.nn.LogSoftmax(dim=1)(gates) # tf.nn.log_softmax(gates)

gate_loss = posteriors.exp()*gates
gate_loss = -torch.sum(gate_loss)
gate_loss = -torch.sum(gate_loss)
loss+=gate_loss

return loss

def e_step(model, breslow_splines, x, t, e, log=False):

# TODO: Do this in `Log Space`
if breslow_splines is None:
# If Breslow splines are not available, like in the first
Expand Down

0 comments on commit e03a4a4

Please sign in to comment.