Skip to content

Commit

Permalink
bump blackjax in test environment
Browse files Browse the repository at this point in the history
  • Loading branch information
ciguaran committed Aug 16, 2024
1 parent 3b65bb1 commit b9f6b3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion conda-envs/environment-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ dependencies:
- statsmodels
- pip:
- pymc>=5.16.1 # CI was failing to resolve
- blackjax
- blackjax>=1.2.3
- scikit-learn
19 changes: 12 additions & 7 deletions pymc_experimental/inference/smc/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import jax
import jax.numpy as jnp
import numpy as np

from blackjax.smc import extend_params
from blackjax.smc.resampling import systematic
from pymc import draw, modelcontext, to_inference_data
Expand Down Expand Up @@ -126,16 +127,20 @@ def sample_smc_blackjax(

if kernel == "HMC":
mcmc_kernel = blackjax.mcmc.hmc
mcmc_parameters = extend_params(dict(
step_size=inner_kernel_params["step_size"],
inverse_mass_matrix=jnp.eye(posterior_dimensions),
num_integration_steps=inner_kernel_params["integration_steps"])
mcmc_parameters = extend_params(
dict(
step_size=inner_kernel_params["step_size"],
inverse_mass_matrix=jnp.eye(posterior_dimensions),
num_integration_steps=inner_kernel_params["integration_steps"],
)
)
elif kernel == "NUTS":
mcmc_kernel = blackjax.mcmc.nuts
mcmc_parameters = extend_params(dict(
step_size=inner_kernel_params["step_size"],
inverse_mass_matrix=jnp.eye(posterior_dimensions))
mcmc_parameters = extend_params(
dict(
step_size=inner_kernel_params["step_size"],
inverse_mass_matrix=jnp.eye(posterior_dimensions),
)
)
else:
raise ValueError(f"Invalid kernel {kernel}, valid options are 'HMC' and 'NUTS'")
Expand Down

0 comments on commit b9f6b3c

Please sign in to comment.