docs: def sample(self, initial_pos, num_samples, stepsize=None, return_type='dataframe'):
          """
          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
  
          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
  
          return_type: string (dataframe | recarray)
              Return type for samples, either of 'dataframe' or 'recarray'.
              Defaults to 'dataframe'
  
          Returns
          -------
          sampled: A pandas.DataFrame or a numpy.recarray object depending upon return_type argument
  
  
          Examples
          ---------
          >>> from pgmpy.sampling import NoUTurnSampler as NUTS, GradLogPDFGaussian, LeapFrog
          >>> from pgmpy.factors.continuous import GaussianDistribution as JGD
          >>> import numpy as np
          >>> mean = np.array([0, 0, 0])
          >>> covariance = np.array([[6, 0.7, 0.2], [0.7, 3, 0.9], [0.2, 0.9, 1]])
          >>> model = JGD(['x', 'y', 'z'], mean, covariance)
          >>> sampler = NUTS(model=model, grad_log_pdf=GradLogPDFGaussian, simulate_dynamics=LeapFrog)
          >>> samples = sampler.sample(initial_pos=np.array([1, 1, 1]), num_samples=10,
          ...                          stepsize=0.4, return_type='dataframe')
          >>> samples
                    x         y         z
          0  1.000000  1.000000  1.000000
          1  1.760756  0.271543 -0.613309
          2  1.883387  0.990745 -0.611720
          3  0.980812  0.340336 -0.916283
          4  0.781338  0.647220 -0.948640
          5  0.040308 -1.391406  0.412201
          6  1.179549 -1.450552  1.105216
          7  1.100320 -1.313926  1.207815
          8  1.484520 -1.349247  0.768599
          9  0.934942 -1.894589  0.471772
          """
          initial_pos = _check_1d_array_object(initial_pos, 'initial_pos')
          _check_length_equal(initial_pos, self.model.variables, 'initial_pos', 'model.variables')
  
          if stepsize is None:
              stepsize = self._find_reasonable_stepsize(initial_pos)
  
          types = [(var_name, 'float') for var_name in self.model.variables]
          samples = np.zeros(num_samples, dtype=types).view(np.recarray)
  
          samples[0] = tuple(initial_pos)
          position_m = initial_pos
  
          for i in range(1, num_samples):
              # Genrating sample
              position_m = self._sample(position_m, stepsize)
              samples[i] = tuple(position_m)
  
          return _return_samples(return_type, samples)