blackjax.mcmc.proposal#
Attributes#
Classes#
Proposal for the next chain step for MCMC with trajectory building (e.g., NUTS). |
Functions#
|
|
|
|
|
|
|
Baised proposal sampling [Bet17]. |
|
Generate a meta function to compute the transition between two states. |
|
Accept or reject a proposal. |
|
Slice sampling for non-reversible Metropolis-Hasting update. |
Module Contents#
- class Proposal[source]#
Proposal for the next chain step for MCMC with trajectory building (e.g., NUTS).
- state:
The trajectory state that corresponds to this proposal.
- energy:
The total energy that corresponds to this proposal.
- weight:
Weight of the proposal. It is equal to the logarithm of the sum of the canonical densities of each state \(e^{-H(z)}\) along the trajectory.
- sum_log_p_accept:
cumulated Metropolis-Hastings acceptance probability across entire trajectory.
- proposal_generator(energy_fn: Callable) tuple[Callable, Callable] [source]#
- Parameters:
energy_fn – A function that computes the energy associated to a given state
- Returns:
Two functions, one to generate an initial proposal when no step has been taken,
another to generate proposals after each step.
- progressive_uniform_sampling(rng_key: blackjax.types.PRNGKey, proposal: Proposal, new_proposal: Proposal) Proposal [source]#
- progressive_biased_sampling(rng_key: blackjax.types.PRNGKey, proposal: Proposal, new_proposal: Proposal) Proposal [source]#
Baised proposal sampling [Bet17].
Unlike uniform sampling, biased sampling favors new proposals. It thus biases the transition away from the trajectory’s initial state.
- compute_asymmetric_acceptance_ratio(transition_energy_fn: Callable) Callable [source]#
Generate a meta function to compute the transition between two states.
In particular, both states are used to compute the energies to consider in weighting the proposal, to account for asymmetries.
- Parameters:
transition_energy_fn – A function that computes the energy of a transition from an initial state to a new state, given some optional keyword arguments.
- Return type:
A functions to compute the acceptance ratio .
- static_binomial_sampling(rng_key: blackjax.types.PRNGKey, log_p_accept: float, proposal, new_proposal)[source]#
Accept or reject a proposal.
In the static setting, the probability with which the new proposal is accepted is a function of the difference in energy between the previous and the current states. If the current energy is lower than the previous one then the new proposal is accepted with probability 1.
- nonreversible_slice_sampling(slice: blackjax.types.Array, delta_energy: float, proposal, new_proposal)[source]#
Slice sampling for non-reversible Metropolis-Hasting update.
Performs a non-reversible update of a uniform [0, 1] value for Metropolis-Hastings accept/reject decisions [Nea20], in addition to the accept/reject step of a current state and new proposal.