class_docstr: Class for performing sampling in Continuous model
  using No U Turn sampler with dual averaging for
  adaptation of parameter stepsize.
  
  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
  
  delta: float (in between 0 and 1), defaults to 0.65
      The target HMC acceptance probability
  
  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","with","dual","averaging","for","adaptation","of","parameter","stepsize",".","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","delta",":","float","(","in","between","0","and","1",")",",","defaults","to","0.65","The","target","HMC","acceptance","probability","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: Returns samples using No U Turn Sampler with dual averaging
  
  Parameters
  ----------
  initial_pos: A 1d array like object
      Vector representing values of parameter position, the starting
      state in markov chain.
  
  num_adapt: int
      The number of interations to run the adaptation of stepsize
  
  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: ["Returns","samples","using","No","U","Turn","Sampler","with","dual","averaging","Parameters","--","--","--","--","--","initial_pos",":","A","1d","array","like","object","Vector","representing","values","of","parameter","position",",","the","starting","state","in","markov","chain",".","num_adapt",":","int","The","number","of","interations","to","run","the","adaptation","of","stepsize","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,
      num_adapt=10,
      stepsize=None,
  ):
      """
      Returns samples using No U Turn Sampler with dual averaging
  
      Parameters
      ----------
      initial_pos: A 1d array like object
          Vector representing values of parameter position, the starting
          state in markov chain.
  
      num_adapt: int
          The number of interations to run the adaptation of stepsize
  
      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)
  
      if num_adapt <= 1:
          return NoUTurnSampler(
              self.model, self.simulate_dynamics
          ).sample(initial_pos, num_samples, stepsize)
  
      mu = np.log(10.0 * stepsize)
      stepsize_bar = 1.0
      h_bar = 0.0
  
      samples = np.zeros([num_samples, len(initial_pos)], dtype=float)
      position_m = initial_pos
  
      for i in range(1, num_samples + burn + 1):
          position_m, alpha, n_alpha = self._sample(
              position_m, stepsize
          )
          # ignore first few samples
          if i >= burn:
              samples[i - burn - 1] = position_m
  
          if i <= num_adapt:
              stepsize, stepsize_bar, h_bar = self._adapt_params(
                  stepsize, stepsize_bar, h_bar, mu, i, alpha, n_alpha
              )
          else:
              stepsize = stepsize_bar
  
      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 4 for calling the NoUTurnSamplerDA obj's underlying member method code with example usage: obj.sample(initial_pos, num_samples, burn, num_adapt, stepsize) and returns: samples, NoUTurnSampler