Skip to content

Commit

Permalink
Convert exponent to float64
Browse files Browse the repository at this point in the history
  • Loading branch information
vpati011 committed Feb 12, 2017
1 parent 54545f8 commit e9d82a6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bayes_logistic/bayes_logistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ def logistic_prob(X, w):
# truncate to avoid numerical over/underflow
z = np.clip(z, -trunc, trunc)

z = [np.float64(x) for x in z]
z = np.array(z)

# calculate logitstic probability
pr = np.exp(z)

pr = pr / (1. + pr)

return pr
Expand Down Expand Up @@ -536,6 +540,9 @@ def bayes_logistic_prob(X, w, H):
# do a truncation to prevent exp overflow
z = np.clip(z, -trunc, trunc)

z = [np.float64(x) for x in z]
z = np.array(z)

# get the moderated logistic probability
pr = np.exp(z)
pr = pr / (1. + pr)
Expand Down

0 comments on commit e9d82a6

Please sign in to comment.