View source on GitHub |
Adapt and sample from a joint distribution, conditioned on pins.
tfp.experimental.mcmc.windowed_adaptive_hmc(
n_draws,
joint_dist,
*,
num_leapfrog_steps,
n_chains=64,
num_adaptation_steps=500,
current_state=None,
init_step_size=None,
dual_averaging_kwargs=None,
trace_fn=default_hmc_trace_fn,
return_final_kernel_results=False,
discard_tuning=True,
chain_axis_names=None,
seed=None,
**pins
)
This uses Hamiltonian Monte Carlo to do the sampling. Step size is tuned using a dual-averaging adaptation, and the kernel is conditioned using a diagonal mass matrix, which is estimated using expanding windows.
Args | |
---|---|
n_draws
|
int Number of draws after adaptation. |
joint_dist
|
tfd.JointDistribution
A joint distribution to sample from.
|
num_leapfrog_steps
|
int Number of leapfrog steps to use for the Hamiltonian Monte Carlo step. |
n_chains
|
int or list of ints Number of independent chains to run MCMC with. |
num_adaptation_steps
|
int Number of draws used to adapt step size and mass matrix. |
current_state
|
Optional
Structure of tensors at which to initialize sampling. Should have the
same shape and structure as
model.experimental_pin(**pins).sample(n_chains) .
|
init_step_size
|
Optional
Where to initialize the step size for the leapfrog integrator. The
structure should broadcast with current_state . For example, if the
initial state is
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Last updated 2023-11-21 UTC.
[null,null,["Last updated 2023-11-21 UTC."],[],[]]
|