blackjax.adaptation.pathfinder_adaptation#

Implementation of the Pathinder warmup for the HMC family of sampling algorithms.

Classes#

Functions#

base([target_acceptance_rate])

Warmup scheme for sampling procedures based on euclidean manifold HMC.

pathfinder_adaptation(→ blackjax.base.AdaptationAlgorithm)

Adapt the value of the inverse mass matrix and step size parameters of

Module Contents#

class PathfinderAdaptationState[source]#
ss_state: blackjax.adaptation.step_size.DualAveragingAdaptationState[source]#
step_size: float[source]#
inverse_mass_matrix: blackjax.types.Array[source]#
base(target_acceptance_rate: float = 0.8)[source]#

Warmup scheme for sampling procedures based on euclidean manifold HMC.

This adaptation runs in two steps:

1. The Pathfinder algorithm is ran and we subsequently compute an estimate for the value of the inverse mass matrix, as well as a new initialization point for the markov chain that is supposedly closer to the typical set. 2. We then start sampling with the MCMC algorithm and use the samples to adapt the value of the step size using an optimization algorithm so that the mcmc algorithm reaches a given target acceptance rate.

Parameters:

target_acceptance_rate – The target acceptance rate for the step size adaptation.

Returns:

  • init – Function that initializes the warmup.

  • update – Function that moves the warmup one step.

  • final – Function that returns the step size and mass matrix given a warmup state.

pathfinder_adaptation(algorithm, logdensity_fn: Callable, initial_step_size: float = 1.0, target_acceptance_rate: float = 0.8, adaptation_info_fn: Callable = return_all_adapt_info, **extra_parameters) blackjax.base.AdaptationAlgorithm[source]#

Adapt the value of the inverse mass matrix and step size parameters of algorithms in the HMC fmaily.

Parameters:
  • algorithm – The algorithm whose parameters are being tuned.

  • logdensity_fn – The log density probability density function from which we wish to sample.

  • initial_step_size – The initial step size used in the algorithm.

  • target_acceptance_rate – The acceptance rate that we target during step size adaptation.

  • adaptation_info_fn – Function to select the adaptation info returned. See return_all_adapt_info and get_filter_adapt_info_fn in blackjax.adaptation.base. By default all information is saved - this can result in excessive memory usage if the information is unused.

  • **extra_parameters – The extra parameters to pass to the algorithm, e.g. the number of integration steps for HMC.

Returns:

  • A function that returns the last chain state and a sampling kernel with the

  • tuned parameter values from an initial state.