MCMC based on multi-particle Hamiltonian dynamics, or more appropriately called "Maxwell Hamiltonian Monte Carlo"
- "A Multi-Trajectory Monte Carlo Sampler"
- "Robust Inference Based On the Complementary Hamiltonian Monte Carlo"
- example.nb
- Sampler.wl
Total energy:
Hamiltonian dynamics:
Euler integration:
The Kinetic energy
For simplicity,
Because
For non-positive (and positive) definite Hessian:
or
Which one is better?
The kinetic energy function that enables correct sampling of multivariate normal distributions may be
Simulation:
If the total energy of a multi-particle system is conserved, then after collition, a particle moves to a new position with a certain probability. it is obvious that, after another collition, the particle can move back with the same probability, i.e. :
Sampling:
Thus, the Metropolis algorithm's acceptance probability can be utilized to determine if a particle moves to the new position:
- Load the sampler.
SetDirectory[NotebookDirectory[]];
<< "Sampler`";
- Ignore the
$K_q$ (optionally) to speed up computation.
Kq[p_, q_, r_] = 0;
- Define the potential energy, i.e. the negative logarithm of probability density function, e.g. a bivariate normal distribution with
$\Sigma$ :
rho = 1 - 1/10^15;
SIGMA = {{1, rho}, {rho, 1}};
U[x_, y_] = 1/2 Simplify[{x, y}.LinearSolve[SIGMA, {x, y}]];
- Define the derivative functions.
Uq[x_, y_] = D1[U[x, y], {x, y}];
Uqq[x_, y_] = D2[U[x, y], {x, y}];
Uqqq[x_, y_] = D3[U[x, y], {x, y}];
- Run the sampler with
$K_{0.5}$ .
Dim = 2;
BURNIN=5000;
ITERATIONS=10000;
QS = hmc[U, Uq, Uqq, Uqqq, Dim, BURNIN, ITERATIONS, {.5}, {}];
- Check the result.
QS1 = QS.MatrixPower[SIGMA, -.5];
StandardDeviation[QS1]
ListPlot[{QS, QS1}, AspectRatio -> 1]
{0.99964, 1.0068}
- The "complementary hamiltonian monte carlo", i.e. using
$K_0$ and$K_1$ :
QS = hmc[U, Uq, Uqq, Uqqq, Dim, BURNIN, ITERATIONS, {0, 1}, {}];
- Run-time parameter can be set:
CHAINS=5;
STEPS=6;
- Flat prior can be implemented by setting a reject region, e.g.:
outbnd[q_] := q[[-1]] <= 0;
- Provide initial value.
qinit = RandomVariate[UniformDistribution[], {CHAINS, Dim}];
QS = hmc[U, Uq, Uqq, Uqqq, Dim, BURNIN, ITERATIONS, {.5}, qinit];
- A remark on a naive question
Multivariate normal distribution can be used to reveal the problems of MCMC methods.
- For MCMC: Statistical Mechanics Algorithms and Computations
- For HMC: Information Theory, Inference, and Learning Algorithms
I had been thinking about this topic alone for years and have received polarized feedback, with headaches :-)
Some nice advice came from Prof. Andrew Gelman.
The idea of multi-particle jumped into my mind in Winnipeg when I was working on some research projects for Dr. Christopher Henry.
Later, Mr. Yang, a billionaire, warned about it during his lavish hospitality: "Good things don't necessarily make money!"
The method of kinetic energy
A few colleagues of Capital of Statistics (COS, editor Yu Miao) read the early draft.
I would also like to thank some mentors and friends for their encouragement years ago: Xu Hongbing (UESTC), Yang Jian (Nankai / NJUST), and Shang Laiyou (IMNU), ...
@ARTICLE{9585691,
author={Xu, Xiaopeng and Liu, Chuancai and Yang, Hongji},
journal={IEEE Transactions on Reliability},
title={Robust Inference Based On the Complementary Hamiltonian Monte Carlo},
year={2022},
volume={71},
number={1},
pages={111-126},
doi={10.1109/TR.2021.3117189}
}
@ARTICLE{ammcs,
author={Xu, Xiaopeng and Liu, Chuancai and Yang, Hongji and Zhang, Xiaochun},
journal={Journal of Internet Technology},
title={A Multi-Trajectory Monte Carlo Sampler},
year={2022},
month={September}
volume={23},
number={5},
pages={1117-1128},
doi={10.1109/TR.2021.3117189}
}