class_docstr: Class for performing sampling using simple
  Hamiltonian Monte Carlo
  
  Parameters:
  -----------
  model: Model from which sampling has to be done
  
  simulate_dynamics: A class to propose future values of
    momentum and position in time by simulating
    Hamiltonian Dynamics
  
  References
  ----------
  R.Neal. Handbook of Markov Chain Monte Carlo,
  chapter 5: MCMC Using Hamiltonian Dynamics.
  CRC Press, 2011.
class_docstr_tok: ["Class","for","performing","sampling","using","simple","Hamiltonian","Monte","Carlo","Parameters",":","--","--","--","--","--","-","model",":","Model","from","which","sampling","has","to","be","done","simulate_dynamics",":","A","class","to","propose","future","values","of","momentum","and","position","in","time","by","simulating","Hamiltonian","Dynamics","References","--","--","--","--","--","R.Neal",".","Handbook","of","Markov","Chain","Monte","Carlo",",","chapter","5",":","MCMC","Using","Hamiltonian","Dynamics",".","CRC","Press",",","2011","."]
docstr: Returns the acceptance probability for given new position(position) and momentum
docstr_tok: ["Returns","the","acceptance","probability","for","given","new","position","(","position",")","and","momentum"]
code: def _acceptance_prob(
      self, position, position_bar, momentum, momentum_bar
  ):
      """
      Returns the acceptance probability for given new position(position) and momentum
      """
  
      # Parameters to help in evaluating Joint distribution P(position, momentum)
      _logp = self.model.logp(position)
      _logp_bar = self.model.logp(position_bar)
  
      # acceptance_prob = P(position_bar, momentum_bar)/ P(position, momentum)
      if not np.isfinite(_logp_bar):
          potential_change = _logp_bar
      else:
          potential_change = _logp_bar - _logp  # Negative change
      kinetic_change = 0.5 * np.float(
          np.dot(momentum_bar.T, momentum_bar)
          - np.dot(momentum.T, momentum)
      )
  
      # acceptance probability
      # return np.exp(potential_change - kinetic_change)
      return potential_change - kinetic_change
  
file_path: dragonfly/dragonfly/sampling/hmc.py
imports: from __future__ import division
  from math import sqrt
  import numpy
  from .check_functions import _check_1d_array_object
  from .base import LeapFrog, BaseSimulateHamiltonianDynamics
label_desc: Use image node_id 2 for calling the HamiltonianMC obj's underlying member method code with example usage: obj._acceptance_prob(position, position_bar, momentum, momentum_bar) and returns: unknown