Skip to content
Snippets Groups Projects
Commit 98ce5be8 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Change to negative log-likelihood.

parent 1c4644b5
No related branches found
No related tags found
No related merge requests found
...@@ -85,13 +85,13 @@ class BernoulliGammaLoss(NaNLoss): ...@@ -85,13 +85,13 @@ class BernoulliGammaLoss(NaNLoss):
# negative log-likelihood function of Bernoulli-Gamma distribution # negative log-likelihood function of Bernoulli-Gamma distribution
# Bernoulli contribution # Bernoulli contribution
loss = (1 - p_true) * torch.log(1 - p_pred + self.epsilon) loss = - (1 - p_true) * torch.log(1 - p_pred + self.epsilon)
# Gamma contribution # Gamma contribution
loss += p_true * (torch.log(p_pred + self.epsilon) + (gshape - 1) * loss -= p_true * (torch.log(p_pred + self.epsilon) + (gshape - 1) *
torch.log(y_true + self.epsilon) - torch.log(y_true + self.epsilon) -
y_true / (gscale + self.epsilon) - y_true / (gscale + self.epsilon) -
gshape * torch.log(gscale + self.epsilon) - gshape * torch.log(gscale + self.epsilon) -
torch.lgamma(gshape + self.epsilon)) torch.lgamma(gshape + self.epsilon))
return - self.reduce(loss) return self.reduce(loss)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment