Skip to content

Commit 48b8749

Browse files
authored
the centering term was wrong (#3806)
The centering term was wrong. I was getting infs for the marginal log likelihood from my model and I dug into the code and found the centering term was wrong. The original term was too large, causing overflows unnecessarily.
1 parent 25f999f commit 48b8749

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pymc3/smc/smc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def update_weights_beta(self):
191191
log_weights_un = (new_beta - old_beta) * self.likelihoods
192192
log_weights = log_weights_un - logsumexp(log_weights_un)
193193

194-
ll_max = np.max(self.likelihoods)
194+
ll_max = np.max(log_weights_un)
195195
self.model.marginal_log_likelihood += ll_max + np.log(
196196
np.exp(log_weights_un - ll_max).mean()
197197
)

0 commit comments

Comments
 (0)