<br />

<button value="stable" default="">See Stable</button> <button value="nightly">See Nightly</button>

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/probability/blob/v0.25.0/tensorflow_probability/python/experimental/mcmc/__init__.py) |

TensorFlow Probability experimental MCMC package.

## Classes

[`class CovarianceReducer`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/CovarianceReducer): `Reducer` that computes a running covariance.

[`class DiagonalMassMatrixAdaptation`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/DiagonalMassMatrixAdaptation): Adapts the inner kernel's `momentum_distribution` to estimated variance.

[`class EllipticalSliceSampler`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/EllipticalSliceSampler): Runs one step of the elliptic slice sampler.

[`class ExpectationsReducer`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/ExpectationsReducer): `Reducer` that computes a running expectation.

[`class GradientBasedTrajectoryLengthAdaptation`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/GradientBasedTrajectoryLengthAdaptation): Use gradient ascent to adapt inner kernel's trajectory length.

[`class GradientBasedTrajectoryLengthAdaptationResults`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/GradientBasedTrajectoryLengthAdaptationResults): Internal state of GradientBasedTrajectoryLengthAdaptation.

[`class KernelBuilder`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/KernelBuilder): Convenience constructor for common MCMC transition kernels.

[`class KernelOutputs`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/KernelOutputs): Facade around outputs of `step_kernel`.

[`class NoUTurnSampler`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/NoUTurnSampler): Runs one step of the No U-Turn Sampler.

[`class PotentialScaleReductionReducer`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/PotentialScaleReductionReducer): `Reducer` that computes a running R-hat diagnostic statistic.

[`class PreconditionedHamiltonianMonteCarlo`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/PreconditionedHamiltonianMonteCarlo): Hamiltonian Monte Carlo, with given momentum distribution.

[`class PreconditionedNoUTurnSampler`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/PreconditionedNoUTurnSampler): Runs one step of the No U-Turn Sampler.

[`class ProgressBarReducer`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/ProgressBarReducer): `Reducer` that displays a progress bar.

[`class Reducer`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/Reducer): Base class for all MCMC `Reducer`s.

[`class SNAPERHamiltonianMonteCarlo`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/SNAPERHamiltonianMonteCarlo): SNAPER-HMC without step size adaptation.

[`class SNAPERHamiltonianMonteCarloResults`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/SNAPERHamiltonianMonteCarloResults): Internal state of SNAPERHamiltonianMonteCarlo.

[`class SampleDiscardingKernel`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/SampleDiscardingKernel): Appropriately discards samples to conduct thinning and burn-in.

[`class SampleSNAPERHamiltonianMonteCarloResults`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/SampleSNAPERHamiltonianMonteCarloResults): Results of `sample_snaper_hmc`.

[`class SequentialMonteCarlo`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/SequentialMonteCarlo): Sequential Monte Carlo transition kernel.

[`class SequentialMonteCarloResults`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/SequentialMonteCarloResults): Auxiliary results from a Sequential Monte Carlo step.

[`class Sharded`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/Sharded): Shards a transition kernel across a named axis.

[`class StateWithHistory`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/StateWithHistory): StateWithHistory(state, state_history)

[`class ThinningKernel`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/ThinningKernel): Discards samples to perform thinning.

[`class TracingReducer`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/TracingReducer): `Reducer` that accumulates trace results at each sample.

[`class VarianceReducer`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/VarianceReducer): `Reducer` that computes running variance.

[`class WeightedParticles`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/WeightedParticles): Particles with corresponding log weights.

[`class WithReductions`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/WithReductions): Applies `Reducer`s to stream over MCMC samples.

[`class WithReductionsKernelResults`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/WithReductionsKernelResults): Reducer state and diagnostics for `WithReductions`.

## Functions

[`augment_prior_with_state_history(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/augment_prior_with_state_history): Augments a prior or proposal distribution's state space with history.

[`augment_with_observation_history(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/augment_with_observation_history): Decorates a function to take `observation_history`.

[`augment_with_state_history(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/augment_with_state_history): Decorates a transition or proposal fn to track state history.

[`chees_criterion(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/chees_criterion): The ChEES criterion from \[1\].

[`chees_rate_criterion(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/chees_rate_criterion): ChEES rate criterion.

[`default_make_hmc_kernel_fn(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/default_make_hmc_kernel_fn): Generate a hmc without transformation kernel.

[`ess_below_threshold(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/ess_below_threshold): Determines if the effective sample size is much less than num_particles.

[`gen_make_hmc_kernel_fn(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/gen_make_hmc_kernel_fn): Generate a transformed hmc kernel.

[`gen_make_transform_hmc_kernel_fn(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/gen_make_transform_hmc_kernel_fn): Generate a transformed hmc kernel.

[`infer_trajectories(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/infer_trajectories): Use particle filtering to sample from the posterior over trajectories.

[`init_near_unconstrained_zero(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/init_near_unconstrained_zero): Returns an initialization Distribution for starting a Markov chain.

[`log_ess_from_log_weights(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/log_ess_from_log_weights): Computes log-ESS estimate from log-weights along axis=particles_dim.

[`make_rwmh_kernel_fn(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/make_rwmh_kernel_fn): Generate a Random Walk MH kernel.

[`make_tqdm_progress_bar_fn(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/make_tqdm_progress_bar_fn): Make a `progress_bar_fn` that uses `tqdm`.

[`particle_filter(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/particle_filter): Samples a series of particles representing filtered latent states.

[`reconstruct_trajectories(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/reconstruct_trajectories): Reconstructs the ancestor trajectory that generated each final particle.

[`remc_thermodynamic_integrals(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/remc_thermodynamic_integrals): Estimate thermodynamic integrals using results of ReplicaExchangeMC.

[`resample_deterministic_minimum_error(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/resample_deterministic_minimum_error): Deterministic minimum error resampler for sequential Monte Carlo.

[`resample_independent(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/resample_independent): Categorical resampler for sequential Monte Carlo.

[`resample_stratified(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/resample_stratified): Stratified resampler for sequential Monte Carlo.

[`resample_systematic(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/resample_systematic): A systematic resampler for sequential Monte Carlo.

[`retry_init(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/retry_init): Tries an MCMC initialization proposal until it gets a valid state.

[`sample_chain(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/sample_chain): Runs a Markov chain defined by the given `TransitionKernel`.

[`sample_chain_with_burnin(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/sample_chain_with_burnin): Implements Markov chain Monte Carlo via repeated `TransitionKernel` steps.

[`sample_fold(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/sample_fold): Computes the requested reductions over the `kernel`'s samples.

[`sample_sequential_monte_carlo(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/sample_sequential_monte_carlo): Runs Sequential Monte Carlo to sample from the posterior distribution.

[`sample_snaper_hmc(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/sample_snaper_hmc): Generates samples using SNAPER HMC \[1\] with step size adaptation.

[`simple_heuristic_tuning(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/simple_heuristic_tuning): Tune the number of steps and scaling of one mutation.

[`snaper_criterion(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/snaper_criterion): The SNAPER criterion from \[1\].

[`step_kernel(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/step_kernel): Takes `num_steps` repeated `TransitionKernel` steps from `current_state`.

[`windowed_adaptive_hmc(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/windowed_adaptive_hmc): Adapt and sample from a joint distribution, conditioned on pins.

[`windowed_adaptive_nuts(...)`](https://www.tensorflow.org/probability/api_docs/python/tfp/experimental/mcmc/windowed_adaptive_nuts): Adapt and sample from a joint distribution using NUTS, conditioned on pins.