Skip to content

Commit

Permalink
Merge 2274bfb into 4f67d63
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Jul 22, 2019
2 parents 4f67d63 + 2274bfb commit 3ecf80e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pymc3/step_methods/smc.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,15 @@ def sample_smc(

while beta < 1:

likelihoods = np.array([likelihood_logp(sample) for sample in posterior]).squeeze()
if step.parallel and cores > 1:
pool = mp.Pool(processes=cores)
results = pool.starmap(
likelihood_logp,
[(sample,) for sample in posterior],
)
else:
results = [likelihood_logp(sample) for sample in posterior]
likelihoods = np.array(results).squeeze()
beta, old_beta, weights, sj = calc_beta(beta, likelihoods, step.threshold)
model.marginal_likelihood *= sj
# resample based on plausibility weights (selection)
Expand Down

0 comments on commit 3ecf80e

Please sign in to comment.