Module: tfp.experimental.mcmc

TensorFlow Probability experimental MCMC package.

Classes

class CovarianceReducer: Reducer that computes a running covariance.

class DiagonalMassMatrixAdaptation: Adapts the inner kernel's momentum_distribution to estimated variance.

class EllipticalSliceSampler: Runs one step of the elliptic slice sampler.

class ExpectationsReducer: Reducer that computes a running expectation.

class GradientBasedTrajectoryLengthAdaptation: Use gradient ascent to adapt inner kernel's trajectory length.

class GradientBasedTrajectoryLengthAdaptationResults: Internal state of GradientBasedTrajectoryLengthAdaptation.

class KernelBuilder: Convenience constructor for common MCMC transition kernels.

class KernelOutputs: Facade around outputs of step_kernel.

class NoUTurnSampler: Runs one step of the No U-Turn Sampler.

class PotentialScaleReductionReducer: Reducer that computes a running R-hat diagnostic statistic.

class PreconditionedHamiltonianMonteCarlo: Hamiltonian Monte Carlo, with given momentum distribution.

class PreconditionedNoUTurnSampler: Runs one step of the No U-Turn Sampler.

class ProgressBarReducer: Reducer that displays a progress bar.

class Reducer: Base class for all MCMC Reducers.

class SNAPERHamiltonianMonteCarlo: SNAPER-HMC without step size adaptation.

class SNAPERHamiltonianMonteCarloResults: Internal state of SNAPERHamiltonianMonteCarlo.

class SampleDiscardingKernel: Appropriately discards samples to conduct thinning and burn-in.

class SampleSNAPERHamiltonianMonteCarloResults: Results of sample_snaper_hmc.

class SequentialMonteCarlo: Sequential Monte Carlo transition kernel.

class SequentialMonteCarloResults: Auxiliary results from a Sequential Monte Carlo step.

class Sharded: Shards a transition kernel across a named axis.

class StateWithHistory: StateWithHistory(state, state_history)

class ThinningKernel: Discards samples to perform thinning.

class TracingReducer: Reducer that accumulates trace results at each sample.

class VarianceReducer: Reducer that computes running variance.

class WeightedParticles: Particles with corresponding log weights.

class WithReductions: Applies Reducers to stream over MCMC samples.

class WithReductionsKernelResults: Reducer state and diagnostics for WithReductions.

Functions

augment_prior_with_state_history(...): Augments a prior or proposal distribution's state space with history.

augment_with_observation_history(...): Decorates a function to take observation_history.

augment_with_state_history(...): Decorates a transition or proposal fn to track state history.

chees_criterion(...): The ChEES criterion from [1].

chees_rate_criterion(...): ChEES rate criterion.

default_make_hmc_kernel_fn(...): Generate a hmc without transformation kernel.

ess_below_threshold(...): Determines if the effective sample size is much less than num_particles.

gen_make_hmc_kernel_fn(...): Generate a transformed hmc kernel.

gen_make_transform_hmc_kernel_fn(...): Generate a transformed hmc kernel.

infer_trajectories(...): Use particle filtering to sample from the posterior over trajectories.

init_near_unconstrained_zero(...): Returns an initialization Distribution for starting a Markov chain.

log_ess_from_log_weights(...): Computes log-ESS estimate from log-weights along axis=0.

make_rwmh_kernel_fn(...): Generate a Random Walk MH kernel.

make_tqdm_progress_bar_fn(...): Make a progress_bar_fn that uses tqdm.

particle_filter(...): Samples a series of particles representing filtered latent states.

reconstruct_trajectories(...): Reconstructs the ancestor trajectory that generated each final particle.

remc_thermodynamic_integrals(...): Estimate thermodynamic integrals using results of ReplicaExchangeMC.

resample_deterministic_minimum_error(...): Deterministic minimum error resampler for sequential Monte Carlo.

resample_independent(...): Categorical resampler for sequential Monte Carlo.

resample_stratified(...): Stratified resampler for sequential Monte Carlo.

resample_systematic(...): A systematic resampler for sequential Monte Carlo.

retry_init(...): Tries an MCMC initialization proposal until it gets a valid state.

sample_chain(...): Runs a Markov chain defined by the given TransitionKernel.

sample_chain_with_burnin(...): Implements Markov chain Monte Carlo via repeated TransitionKernel steps.

sample_fold(...): Computes the requested reductions over the kernel's samples.

sample_sequential_monte_carlo(...): Runs Sequential Monte Carlo to sample from the posterior distribution.

sample_snaper_hmc(...): Generates samples using SNAPER HMC [1] with step size adaptation.

simple_heuristic_tuning(...): Tune the number of steps and scaling of one mutation.

snaper_criterion(...): The SNAPER criterion from [1].

step_kernel(...): Takes num_steps repeated TransitionKernel steps from current_state.

windowed_adaptive_hmc(...): Adapt and sample from a joint distribution, conditioned on pins.

windowed_adaptive_nuts(...): Adapt and sample from a joint distribution using NUTS, conditioned on pins.