  We present a novel technique for learning the mass matrices in samplers
obtained from discretized dynamics that preserve some energy function. Existing
adaptive samplers use Riemannian preconditioning techniques, where the mass
matrices are functions of the parameters being sampled. This leads to
significant complexities in the energy reformulations and resultant dynamics,
often leading to implicit systems of equations and requiring inversion of
high-dimensional matrices in the leapfrog steps. Our approach provides a
simpler alternative, by using existing dynamics in the sampling step of a Monte
Carlo EM framework, and learning the mass matrices in the M step with a novel
online technique. We also propose a way to adaptively set the number of samples
gathered in the E step, using sampling error estimates from the leapfrog
dynamics. Along with a novel stochastic sampler based on Nos\'{e}-Poincar\'{e}
dynamics, we use this framework with standard Hamiltonian Monte Carlo (HMC) as
well as newer stochastic algorithms such as SGHMC and SGNHT, and show strong
performance on synthetic and real high-dimensional sampling scenarios; we
achieve sampling accuracies comparable to Riemannian samplers while being
significantly faster.
