Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions impulse/sampler_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ def vectorized_mh_step(state: SamplerState,
# propose a set of new proposals
x_stars, qxys = prop_fn(state)

# compute new prior
# evaluate prior first
lnprior_stars = lnprior_fn(x_stars)
lnlike_stars = lnlike_fn(x_stars)

# only evaluate likelihood where prior is finite
valid = np.isfinite(lnprior_stars)
lnlike_stars = np.full_like(lnprior_stars, -np.inf)
if np.any(valid):
lnlike_stars[valid] = lnlike_fn(x_stars[valid])

lnprob_stars = 1 / state.temps * lnlike_stars + lnprior_stars

probability_ratios = lnprob_stars - (state.lnprobs) + qxys
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = [
]
description = "Parallel tempering MCMC with adaptive proposals, NUTS, and reversible-jump model selection"
readme = "README.md"
license = "MIT"
# license = "MIT"
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Python :: 3",
Expand Down
Loading