Class AbstractHybridMCMC
java.lang.Object
dev.nm.stat.random.rng.multivariate.mcmc.metropolis.AbstractMetropolis
dev.nm.stat.random.rng.multivariate.mcmc.hybrid.AbstractHybridMCMC
- All Implemented Interfaces:
RandomVectorGenerator
,Seedable
- Direct Known Subclasses:
HybridMCMC
,MultipointHybridMCMC
Hybrid Monte Carlo, or Hamiltonian Monte Carlo, is a method that combines the traditional
Metropolis algorithm, with molecular dynamics simulation. The idea is to make use of
the equations from classical mechanics, to guide our choice of proposed state.
At each step we generate a random momentum vector, where each component is drawn from a Gaussian
distribution. Considering the target density as the potential energy field of the system and the
current state as the initial position of the molecules, we perform a molecular dynamics
simulation (using the LeapFrogging algorithm) for the given time period.
The final position of the molecules is taken as the next proposed state. The acceptance-rejection
decision is then done like as in the classical Metropolis algorithm.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractHybridMCMC
(Vector initialState, RandomNumberGenerator rng) Constructs a new instance with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic RealVectorFunction
dUdx
(RealVectorFunction dLogF) Gets the derivative of the potential function, given the derivative of the log density.static double
H
(LeapFrogging.DynamicsState state, RealScalarFunction logF, Vector m) Evaluates a system's total energy at a given state.static double
Evaluates the standard kinetic energy, k = p^2 / 2m.final void
setDeltaT
(double dt) Sets the value of dt that will be used in the subsequent iterations.Methods inherited from class dev.nm.stat.random.rng.multivariate.mcmc.metropolis.AbstractMetropolis
acceptanceRate, isProposalAccepted, nextProposedState, nextVector, seed
-
Field Details
-
dt
protected double dt
-
-
Constructor Details
-
AbstractHybridMCMC
Constructs a new instance with the given parameters.- Parameters:
initialState
- the initial state of the algorithmrng
- a random number generator
-
-
Method Details
-
setDeltaT
public final void setDeltaT(double dt) Sets the value of dt that will be used in the subsequent iterations. This is useful for varying the time step size between iterations.- Parameters:
dt
- the value of dt
-
dUdx
Gets the derivative of the potential function, given the derivative of the log density.- Parameters:
dLogF
- the derivative of the log density, density logF = -U(x)- Returns:
- the derivative of the potential function
-
H
Evaluates a system's total energy at a given state.- Parameters:
state
- the state of the systemlogF
- the log-density function, -U(x)m
- the mass of the components- Returns:
- the total energy, H(x, p)
-
k
Evaluates the standard kinetic energy, k = p^2 / 2m.- Parameters:
p
-m
-- Returns:
- k
-