Skip to content

Commit

Permalink
Merge pull request #64 from MindSetLib/asupdates
Browse files Browse the repository at this point in the history
Minor fixes in deviance
  • Loading branch information
alexmindset authored Mar 24, 2021
2 parents a2c4995 + 9c02c35 commit 7e9cab9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions insolver/model_tools/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ def deviance_poisson(y_hat, y, weight=None):
"""
t_hat, t = y_hat + 1, y + 1
if weight:
return 2 * sum(weight*(t * log(t / t_hat) - (t - t_hat)))
return sum(2 * weight * (t * log(t / t_hat) - (t - t_hat)))
else:
return 2 * sum(t * log(t / t_hat) - (t - t_hat))
return sum(2 * (t * log(t / t_hat) - (t - t_hat)))


def deviance_gamma(y_hat, y, weight=None):
Expand All @@ -126,6 +126,6 @@ def deviance_gamma(y_hat, y, weight=None):
float, value of the Gamma deviance.
"""
if weight:
return 2 * sum(weight*(-log(y/y_hat) + (y-y_hat)/y_hat))
return sum(2 * weight * (-log(y/y_hat) + (y-y_hat)/y_hat))
else:
return 2 * sum(-log(y/y_hat) + (y-y_hat)/y_hat)
return sum(2 * (-log(y/y_hat) + (y-y_hat)/y_hat))

0 comments on commit 7e9cab9

Please sign in to comment.