Skip to content

Commit

Permalink
Merge pull request #485 from pints-team/i472-dream-division
Browse files Browse the repository at this point in the history
Avoided div-by-zero in dream
  • Loading branch information
MichaelClerx authored Aug 31, 2018
2 parents 7e09b5d + afcaaa9 commit d364fc6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pints/_mcmc/_dream.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,11 @@ def tell(self, proposed_log_pdfs):
delta[j][d] / max(self._variance[j][d], 1e-11))

self._p = self._iterations * self._chains * self._delta
self._p /= self._L * np.sum(self._delta)
self._p /= np.sum(self._p)
d1 = self._L * np.sum(self._delta)
d1[d1 == 0] += 1e-11
self._p /= d1
d2 = max(np.sum(self._p), 1e-11)
self._p /= d2

# Update iteration count for running mean/variance
self._iterations += 1
Expand Down

0 comments on commit d364fc6

Please sign in to comment.