blackjax.adaptation.adjusted_mclmc_adaptation#

Attributes#

Functions#

adjusted_mclmc_find_L_and_step_size(mclmc_kernel, ...)

Finds the optimal value of the parameters for the MH-MCHMC algorithm.

adjusted_mclmc_make_L_step_size_adaptation(kernel, ...)

Adapts the stepsize and L of the MCLMC kernel. Designed for adjusted MCLMC

adjusted_mclmc_make_adaptation_L(kernel, frac, Lfactor)

determine L by the autocorrelations (around 10 effective samples are needed for this to be accurate)

handle_nans(previous_state, next_state, step_size, ...)

if there are nans, let's reduce the stepsize, and not update the state. The

Module Contents#

Lratio_lowerbound = 0.0[source]#
Lratio_upperbound = 2.0[source]#
adjusted_mclmc_find_L_and_step_size(mclmc_kernel, num_steps, state, rng_key, target, frac_tune1=0.1, frac_tune2=0.1, frac_tune3=0.0, diagonal_preconditioning=True, params=None, max='avg', num_windows=1, tuning_factor=1.3)[source]#

Finds the optimal value of the parameters for the MH-MCHMC algorithm.

Parameters:
  • mclmc_kernel – The kernel function used for the MCMC algorithm.

  • num_steps – The number of MCMC steps that will subsequently be run, after tuning.

  • state – The initial state of the MCMC algorithm.

  • rng_key – The random number generator key.

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

  • frac_tune1 – The fraction of tuning for the first step of the adaptation.

  • frac_tune2 – The fraction of tuning for the second step of the adaptation.

  • frac_tune3 – The fraction of tuning for the third step of the adaptation.

  • diagonal_preconditioning – Whether to do diagonal preconditioning (i.e. a mass matrix)

  • params – Initial params to start tuning from (optional)

  • max – whether to calculate L from maximum or average eigenvalue. Average is advised.

  • num_windows – how many iterations of the tuning are carried out

  • tuning_factor – multiplicative factor for L

Return type:

A tuple containing the final state of the MCMC algorithm and the final hyperparameters.

adjusted_mclmc_make_L_step_size_adaptation(kernel, dim, frac_tune1, frac_tune2, target, diagonal_preconditioning, fix_L_first_da=False, max='avg', tuning_factor=1.0)[source]#

Adapts the stepsize and L of the MCLMC kernel. Designed for adjusted MCLMC

adjusted_mclmc_make_adaptation_L(kernel, frac, Lfactor, max='avg', eigenvector=None)[source]#

determine L by the autocorrelations (around 10 effective samples are needed for this to be accurate)

handle_nans(previous_state, next_state, step_size, step_size_max, kinetic_change)[source]#

if there are nans, let’s reduce the stepsize, and not update the state. The function returns the old state in this case.