mutation
Ensemble mutation for the BlackJAX SMC sampler modes.
A mutation moves every particle at one temperature. The particles first go to
coordinates fitted to the current ensemble: periodic angles are re-centred onto
the real line and, when a flow is configured, mapped through a normalizing flow
trained on the particles. A kernel (a Gaussian random walk or t-pCN) then takes
Metropolis-Hastings steps in those coordinates. The acceptance ratio includes
the Jacobian of the map, so the particles still target Jim's posterior. BlackJAX
runs the mutation through its update_strategy hook.
EnsembleMutation
¤
Moves all SMC particles at one temperature, in coordinates fitted to them.
Hand read_parameters, mcmc_init_fn, update_strategy and
mcmc_parameter_update_fn to blackjax.inner_kernel_tuning, with
extend_params(initial_parameter_value()) as the initial parameter value and
max_steps as num_mcmc_steps. The only parameter carried from one
mutation to the next is the kernel's step size; a flow is trained afresh
at every mutation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_dims
|
int
|
Dimension of the sampling space. |
required |
periodic
|
Optional[dict[int, tuple[float, float]]]
|
Periodic dimensions as |
required |
kernel_config
|
SMCKernelConfig
|
Config of the kernel that moves the particles. |
required |
flow_config
|
Union[SMCFlowConfig, Literal[False]]
|
Config of the normalizing flow, or |
required |
Methods:
| Name | Description |
|---|---|
initial_parameter_value |
Carried parameters for the first mutation (pass through |
mcmc_init_fn |
BlackJAX's |
mcmc_parameter_update_fn |
BlackJAX's |
read_parameters |
BlackJAX's |
summary |
One mutation's numbers as Python values, for the mutation history and logging. |
update_strategy |
BlackJAX's |
initial_parameter_value() -> dict[str, Array]
¤
Carried parameters for the first mutation (pass through extend_params).
mcmc_init_fn(position: Array, logdensity_fn: Callable) -> Any
¤
BlackJAX's mcmc_init_fn; never called, as there is no per-particle state.
mcmc_parameter_update_fn(key: Key[Array, ''], state: Any, info: Any) -> dict[str, Array]
¤
BlackJAX's mcmc_parameter_update_fn: carries the parameters forward.
read_parameters(**parameters: Array) -> dict[str, Array]
¤
BlackJAX's mcmc_step_fn, used only to read the carried parameters.
BlackJAX binds the carried parameters to mcmc_step_fn;
update_strategy calls it with no arguments to get them back.
summary(update_info: dict) -> dict[str, Any]
¤
One mutation's numbers as Python values, for the mutation history and logging.
update_strategy(mcmc_init_fn: Callable, logposterior_fn: Callable, shared_mcmc_step_fn: Callable, num_mcmc_steps: int, n_particles: int, batch_size: int = 0) -> tuple[Callable, int]
¤
BlackJAX's update_strategy: returns (update_fn, n_particles).
update_fn runs one mutation of all particles and returns the moved
particles and the mutation's info dict.