Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about DSM #142

Open
WenxiongLiao opened this issue Jun 25, 2024 · 0 comments
Open

Questions about DSM #142

WenxiongLiao opened this issue Jun 25, 2024 · 0 comments

Comments

@WenxiongLiao
Copy link

WenxiongLiao commented Jun 25, 2024

def _weibull_loss(model, t, e, risk='1'):

  shape, scale = model.get_shape_scale(risk)

  k_ = shape.expand(t.shape[0], -1)
  b_ = scale.expand(t.shape[0], -1)

  ll = 0.
  for g in range(model.k):

    k = k_[:, g]
    b = b_[:, g]

    s = - (torch.pow(torch.exp(b)*t, torch.exp(k)))
    f = k + b + ((torch.exp(k)-1)*(b+torch.log(t)))
    f = f + s

    uncens = np.where(e.cpu().data.numpy() == int(risk))[0]
    cens = np.where(e.cpu().data.numpy() != int(risk))[0]
    ll += f[uncens].sum() + s[cens].sum()

  return -ll.mean()

s = - (torch.pow(torch.exp(b)t, torch.exp(k)))
f = k + b + ((torch.exp(k)-1)
(b+torch.log(t)))
f = f + s

How was this derived? Can you give a more detailed derivation process?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant