blackjax.smc.from_mcmc#
Functions#
|
Split MCMC parameters into shared and unshared parameters. |
|
Build an SMC step function from MCMC kernels. |
Module Contents#
Split MCMC parameters into shared and unshared parameters.
The shared dictionary represents the parameters common to all chains, and the unshared are different per chain. Binds the step function using the shared parameters.
- Parameters:
mcmc_parameters (dict) – Dictionary of MCMC parameters. Parameters with shape[0] == 1 are considered shared across all chains.
mcmc_step_fn (Callable) – MCMC step function.
- Returns:
unshared_mcmc_parameters (dict) – Parameters that differ per chain.
shared_mcmc_step_fn (Callable) – MCMC step function with shared parameters bound.
- build_kernel(mcmc_step_fn: Callable, mcmc_init_fn: Callable, resampling_fn: Callable, update_strategy: Callable = update_and_take_last) Callable[source]#
Build an SMC step function from MCMC kernels.
Builds MCMC kernels from the input parameters, which may change across iterations. Moreover, it defines the way such kernels are used to update the particles. This layer adapts an API defined in terms of kernels (mcmc_step_fn and mcmc_init_fn) into an API that depends on an update function over the set of particles.
- Parameters:
mcmc_step_fn (Callable) – MCMC step function.
mcmc_init_fn (Callable) – Function that initializes an MCMC state from a position.
resampling_fn (Callable) – Resampling function (from blackjax.smc.resampling).
update_strategy (Callable) – Strategy to update particles using MCMC kernels, by default ‘update_and_take_last’ from blackjax.smc.base.
- Returns:
step – A callable that takes a rng_key and a state with .particles and .weights and returns a base.SMCState and base.SMCInfo pair.
- Return type:
Callable