class_docstr: Class for simulating Hamiltonian Dynamics using Modified euler method
  Inherits pgmpy.inference.base_continuous.BaseSimulateHamiltonianDynamics
  
  Parameters
  ----------
  model: An instance of pgmpy.models
      Model for which DiscretizeTime object is initialized
  
  position: A 1d array like object (numpy.ndarray or list)
      Vector representing values of parameter position( or X)
  
  momentum: A 1d array like object (numpy.ndarray or list)
      Vector representing the proposed value for momentum (velocity)
  
  stepsize: Float
      stepsize for the simulating dynamics
  
  grad_log_pdf: A subclass of pgmpy.inference.continuous.BaseGradLogPDF, defaults to None
      A class for finding gradient log and log of distribution
      If None, then will use model.get_gradient_log_pdf
  
  grad_log_position: A 1d array like object, defaults to None
      Vector representing gradient log at given position
      If None, then will be calculated
  
  Example
  --------
  >>> from pgmpy.factors.continuous import GaussianDistribution
  >>> from pgmpy.sampling import GradLogPDFGaussian, ModifiedEuler
  >>> import numpy as np
  >>> pos = np.array([2, 1])
  >>> momentum = np.array([1, 1])
  >>> mean = np.array([0, 0])
  >>> covariance = np.eye(2)
  >>> model = GaussianDistribution(['x', 'y'], mean, covariance)
  >>> new_pos, new_momentum, new_grad = ModifiedEuler(model, pos, momentum,
  ...                                                 0.25, GradLogPDFGaussian).get_proposed_values()
  >>> new_pos
  array([2.125, 1.1875])
  >>> new_momentum
  array([0.5, 0.75])
  >>> new_grad
  array([-2.125, -1.1875])
class_docstr_tok: ["Class","for","simulating","Hamiltonian","Dynamics","using","Modified","euler","method","Inherits","pgmpy.inference.base_continuous.BaseSimulateHamiltonianDynamics","Parameters","--","--","--","--","--","model",":","An","instance","of","pgmpy.models","Model","for","which","DiscretizeTime","object","is","initialized","position",":","A","1d","array","like","object","(","numpy.ndarray","or","list",")","Vector","representing","values","of","parameter","position","(","or","X",")","momentum",":","A","1d","array","like","object","(","numpy.ndarray","or","list",")","Vector","representing","the","proposed","value","for","momentum","(","velocity",")","stepsize",":","Float","stepsize","for","the","simulating","dynamics","grad_log_pdf",":","A","subclass","of","pgmpy.inference.continuous.BaseGradLogPDF",",","defaults","to","None","A","class","for","finding","gradient","log","and","log","of","distribution","If","None",",","then","will","use","model.get_gradient_log_pdf","grad_log_position",":","A","1d","array","like","object",",","defaults","to","None","Vector","representing","gradient","log","at","given","position","If","None",",","then","will","be","calculated","Example","--","--","--","--",">",">",">","from","pgmpy.factors.continuous","import","GaussianDistribution",">",">",">","from","pgmpy.sampling","import","GradLogPDFGaussian",",","ModifiedEuler",">",">",">","import","numpy","as","np",">",">",">","pos","=","np.array","(","[","2",",","1","]",")",">",">",">","momentum","=","np.array","(","[","1",",","1","]",")",">",">",">","mean","=","np.array","(","[","0",",","0","]",")",">",">",">","covariance","=","np.eye","(","2",")",">",">",">","model","=","GaussianDistribution","(","[","'","x","'",",","'","y","'","]",",","mean",",","covariance",")",">",">",">","new_pos",",","new_momentum",",","new_grad","=","ModifiedEuler","(","model",",","pos",",","momentum",",","...","0.25",",","GradLogPDFGaussian",")",".get_proposed_values","(",")",">",">",">","new_pos","array","(","[","2.125",",","1.1875","]",")",">",">",">","new_momentum","array","(","[","0.5",",","0.75","]",")",">",">",">","new_grad","array","(","[","-2.125",",","-1.1875","]",")"]
code: def __init__(
      self,
      model,
      position,
      momentum,
      stepsize,
      grad_log_pdf,
      grad_log_position=None,
  ):
      BaseSimulateHamiltonianDynamics.__init__(
          self,
          model,
          position,
          momentum,
          stepsize,
          grad_log_pdf,
          grad_log_position,
      )
  
      (
          self.new_position,
          self.new_momentum,
          self.new_grad_logp,
      ) = self._get_proposed_values()
  
imports: import itertools
  import math
  import os
  import networkx
  import numpy
  import pandas
  from joblib import Parallel, delayed
  from pgmpy.inference import Inference
  from pgmpy.utils import _check_1d_array_object, _check_length_equal, compat_fns
label_desc: Use image node_id 1 to create a new ModifiedEuler object from inherited base classes: BaseSimulateHamiltonianDynamics with example: obj = ModifiedEuler(model, position, momentum, stepsize, grad_log_pdf, grad_log_position)