Apply to speak at TensorFlow World. Deadline April 23rd. Propose talk

tfp.mcmc.UncalibratedLangevin

Class UncalibratedLangevin

Inherits From: TransitionKernel

Runs one step of Uncalibrated Langevin discretized diffusion.

The class generates a Langevin proposal using _euler_method function and also computes helper UncalibratedLangevinKernelResults for the next iteration.

For more details on UncalibratedLangevin, see MetropolisAdjustedLangevinAlgorithm.

__init__

__init__(
    target_log_prob_fn,
    step_size,
    volatility_fn=None,
    parallel_iterations=10,
    compute_acceptance=True,
    seed=None,
    name=None
)

Initializes Langevin diffusion transition kernel.

Args:

  • target_log_prob_fn: Python callable which takes an argument like current_state (or *current_state if it's a list) and returns its (possibly unnormalized) log-density under the target distribution.
  • step_size: Tensor or Python list of Tensors representing the step size for the leapfrog integrator. Must broadcast with the shape of current_state. Larger step sizes lead to faster progress, but too-large step sizes make rejection exponentially more likely. When possible, it's often helpful to match per-variable step sizes to the standard deviations of the target distribution in each variable.
  • volatility_fn: Python callable which takes an argument like current_state (or *current_state if it's a list) and returns volatility value at current_state. Should return a Tensor or Python list of Tensors that must broadcast with the shape of current_state Defaults to the identity function.
  • parallel_iterations: the number of coordinates for which the gradients of the volatility matrix volatility_fn can be computed in parallel.
  • compute_acceptance: Python 'bool' indicating whether to compute the Metropolis log-acceptance ratio used to construct MetropolisAdjustedLangevinAlgorithm kernel.
  • seed: Python integer to seed the random number generator. Default value: None (i.e., no seed).
  • name: Python str name prefixed to Ops created by this function. Default value: None (i.e., 'mala_kernel').

Returns:

  • next_state: Tensor or Python list of Tensors representing the state(s) of the Markov chain(s) at each result step. Has same shape as current_state.
  • kernel_results: collections.namedtuple of internal calculations used to advance the chain.

Raises:

  • ValueError: if there isn't one step_size or a list with same length as current_state.
  • TypeError: if volatility_fn is not callable.

Properties

compute_acceptance

is_calibrated

name

parallel_iterations

parameters

Return dict of __init__ arguments and their values.

seed

step_size

target_log_prob_fn

volatility_fn

Methods

bootstrap_results

bootstrap_results(init_state)

Creates initial previous_kernel_results using a supplied state.

one_step

one_step(
    current_state,
    previous_kernel_results
)

Runs one iteration of MALA.

Args:

  • current_state: Tensor or Python list of Tensors representing the current state(s) of the Markov chain(s). The first r dimensions index independent chains, r = tf.rank(target_log_prob_fn(*current_state)).
  • previous_kernel_results: collections.namedtuple containing Tensors representing values from previous calls to this function (or from the bootstrap_results function.)

Returns:

  • next_state: Tensor or Python list of Tensors representing the state(s) of the Markov chain(s) after taking exactly one step. Has same type and shape as current_state.
  • kernel_results: collections.namedtuple of internal calculations used to advance the chain.

Raises:

  • ValueError: if there isn't one step_size or a list with same length as current_state or diffusion_drift.