Hybrid Monte Carlo¶
-
breze.learn.sampling.hmc.
sample
(f_energy, f_energy_prime, position, n_steps, desired_accept=0.9, initial_step_size=0.01, step_size_grow=1.02, step_size_shrink=0.98, step_size_min=0.0001, step_size_max=0.25, avg_accept_slowness=0.9, sample_dim=0)¶ Return a sample from the distribution given by f_energy.
Parameters: - f_energy – Log of a function proportional to the density.
- f_energy_prime – Derivative of f_energy wrt to the current position.
- position – An numpy array of any desired shape which represents multiple particles.
- n_steps – Amount of steps to perform for the next sample.
- desired_accept – Desired acceptance rate of the underlying Metropolis hastings.
- initial_step_size – Initial size of a step along the energy landscape.
- step_size_grow – If the acceptance rate is too high, increase the step size by this factor.
- step_size_shrink – If the acceptance rate is too low, decrease the step size by this factor.
- step_size_min – Don’t decrease the step size below this value.
- step_size_max – Don’t increase the step size above this value.
- avg_accept_slowness – When calculating the acceptance rate, use this value as a decay for an exponential average.
- sample_dim – The axis which discriminates the different particles given in the position array from each other.