code: def test_sample(self):
      # Seeding is done for _find_reasonable_stepsize method
      # Testing sample method simple HMC
      np.random.seed(3124141)
      samples = self.hmc_sampler.sample(
          initial_pos=[0.3, 0.4, 0.2],
          num_adapt=0,
          num_samples=10000,
          trajectory_length=4,
      )
      covariance = np.cov(samples.values.T)
      self.assertTrue(
          np.linalg.norm(covariance - self.test_model.covariance) < 3
      )
  
      # Testing sample of method of HMCda
      np.random.seed(3124141)
      samples = self.hmc_sampler.sample(
          initial_pos=[0.6, 0.2, 0.8],
          num_adapt=10000,
          num_samples=10000,
          trajectory_length=4,
      )
      covariance = np.cov(samples.values.T)
      self.assertTrue(
          np.linalg.norm(covariance - self.test_model.covariance) < 0.3
      )
  
      # Testing generate_sample method of simple HMC
      np.random.seed(3124141)
      gen_samples = self.hmc_sampler.generate_sample(
          initial_pos=[0.3, 0.4, 0.2],
          num_adapt=0,
          num_samples=10000,
          trajectory_length=4,
      )
      samples = np.array([sample for sample in gen_samples])
      covariance = np.cov(samples.T)
      self.assertTrue(
          np.linalg.norm(covariance - self.test_model.covariance) < 3
      )
  
      # Testing sample of method of HMCda
      np.random.seed(3124141)
      gen_samples = self.hmc_sampler.generate_sample(
          initial_pos=[0.6, 0.2, 0.8],
          num_adapt=10000,
          num_samples=10000,
          trajectory_length=4,
      )
      samples = np.array([sample for sample in gen_samples])
      covariance = np.cov(samples.T)
      self.assertTrue(
          np.linalg.norm(covariance - self.test_model.covariance) < 0.3
      )
  
imports: import sys
  import unittest
  import numpy
  from pgmpy.factors.distributions import GaussianDistribution
  from pgmpy.sampling import HamiltonianMC, HamiltonianMCDA, GradLogPDFGaussian, NoUTurnSampler, NoUTurnSamplerDA
label_desc: Use image node_id 6 for calling the TestHMCInference obj's underlying member method code with example usage: obj.test_sample() without return types