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?
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?