Hamiltonian Monte Carlo (HMC) sampler
A Hamiltonian Monte Carlo (HMC) sampler is a gradient-based Markov Chain Monte Carlo sampler that you can use to generate samples from a probability density P(x). HMC sampling requires specification of log P(x) and its gradient.
The parameter vector x must be unconstrained, meaning that every element of x can be any real number. To sample constrained parameters, transform these parameters into unconstrained variables before using the HMC sampler.
After creating a sampler, you can compute MAP (maximum-a-posteriori) point estimates, tune the sampler, draw samples, and check convergence diagnostics using the methods of this class. For an example of this workflow, see Bayesian Linear Regression Using Hamiltonian Monte Carlo.
creates a Hamiltonian Monte Carlo (HMC) sampler, returned as a
hmc
= hmcSampler(logpdf
,startpoint
)HamiltonianSampler
object. logpdf
is a
function handle that evaluates the logarithm of the probability density of the
equilibrium distribution and its gradient. The column vector
startpoint
is the initial point from which to start HMC
sampling.
specifies additional options using one or more name-value pair arguments. Specify
name-value pair arguments after all other input arguments.hmc
= hmcSampler(___,Name,Value
)
diagnostics | Markov Chain Monte Carlo diagnostics |
drawSamples | Generate Markov chain using Hamiltonian Monte Carlo (HMC) |
estimateMAP | Estimate maximum of log probability density |
tuneSampler | Tune Hamiltonian Monte Carlo (HMC) sampler |