class_docstr: Class for performing sampling in Continuous model
  using No U Turn Sampler (a variant of Hamiltonian Monte Carlo)
  
  Parameters:
  -----------
  model: Model from which sampling has to be done
  
  simulate_dynamics: Class to propose future states of position
      and momentum in time by simulating HamiltonianDynamics
  
  References
  ----------
  Matthew D. Hoffman, Andrew Gelman, The No-U-Turn Sampler: Adaptively
  Setting Path Lengths in Hamiltonian Monte Carlo. Journal of
  Machine Learning Research 15 (2014) 1351-1381
class_docstr_tok: ["Class","for","performing","sampling","in","Continuous","model","using","No","U","Turn","Sampler","(","a","variant","of","Hamiltonian","Monte","Carlo",")","Parameters",":","--","--","--","--","--","-","model",":","Model","from","which","sampling","has","to","be","done","simulate_dynamics",":","Class","to","propose","future","states","of","position","and","momentum","in","time","by","simulating","HamiltonianDynamics","References","--","--","--","--","--","Matthew","D.","Hoffman",",","Andrew","Gelman",",","The","No-U-Turn","Sampler",":","Adaptively","Setting","Path","Lengths","in","Hamiltonian","Monte","Carlo",".","Journal","of","Machine","Learning","Research","15","(","2014",")","1351-1381"]
docstr: Method to return samples using No U Turn Sampler
  
  Parameters
  ----------
  initial_pos: A 1d array like object
      Vector representing values of parameter position, the starting
      state in markov chain.
  
  num_samples: int
      Number of samples to be generated
  
  burn: int, defaults to 150
      Number of samples to be ignored in the beginning
  
  stepsize: float , defaults to None
      The stepsize for proposing new values of position and momentum in
      simulate_dynamics. If None, then will be choosen suitably
docstr_tok: ["Method","to","return","samples","using","No","U","Turn","Sampler","Parameters","--","--","--","--","--","initial_pos",":","A","1d","array","like","object","Vector","representing","values","of","parameter","position",",","the","starting","state","in","markov","chain",".","num_samples",":","int","Number","of","samples","to","be","generated","burn",":","int",",","defaults","to","150","Number","of","samples","to","be","ignored","in","the","beginning","stepsize",":","float",",","defaults","to","None","The","stepsize","for","proposing","new","values","of","position","and","momentum","in","simulate_dynamics",".","If","None",",","then","will","be","choosen","suitably"]
code: def sample(self, initial_pos, num_samples, burn=150, stepsize=None):
      """
      Method to return samples using No U Turn Sampler
  
      Parameters
      ----------
      initial_pos: A 1d array like object
          Vector representing values of parameter position, the starting
          state in markov chain.
  
      num_samples: int
          Number of samples to be generated
  
      burn: int, defaults to 150
          Number of samples to be ignored in the beginning
  
      stepsize: float , defaults to None
          The stepsize for proposing new values of position and momentum in
          simulate_dynamics. If None, then will be choosen suitably
      """
  
      if not hasattr(initial_pos, "__len__"):
          initial_pos = np.array([initial_pos])
      initial_pos = _check_1d_array_object(initial_pos, "initial_pos")
  
      if stepsize is None:
          stepsize = self._find_reasonable_stepsize(initial_pos)
  
      samples = np.zeros([num_samples, len(initial_pos)], dtype=float)
      position_m = initial_pos
  
      for i in range(1, num_samples + burn + 1):
          # Genrating sample
          position_m = self._sample(position_m, stepsize)
          # ignore first few samples
          if i >= burn:
              samples[i - burn - 1] = position_m
  
      return samples
  
file_path: dragonfly/dragonfly/sampling/nuts.py
imports: from __future__ import division
  import numpy
  from .base import LeapFrog
  from .hmc import HamiltonianMCDA
  from .check_functions import _check_1d_array_object
label_desc: Use image node_id 6 for calling the NoUTurnSampler obj's underlying member method code with example usage: obj.sample(initial_pos, num_samples, burn, stepsize) and returns: samples