code: def setUp(self):
      # Bayesian Model without state names
      self.bayesian_model = BayesianNetwork(
          [("A", "J"), ("R", "J"), ("J", "Q"), ("J", "L"), ("G", "L")]
      )
      cpd_a = TabularCPD("A", 2, [[0.2], [0.8]])
      cpd_r = TabularCPD("R", 2, [[0.4], [0.6]])
      cpd_j = TabularCPD(
          "J",
          2,
          [[0.9, 0.6, 0.7, 0.1], [0.1, 0.4, 0.3, 0.9]],
          ["R", "A"],
          [2, 2],
      )
      cpd_q = TabularCPD("Q", 2, [[0.9, 0.2], [0.1, 0.8]], ["J"], [2])
      cpd_l = TabularCPD(
          "L",
          2,
          [[0.9, 0.45, 0.8, 0.1], [0.1, 0.55, 0.2, 0.9]],
          ["G", "J"],
          [2, 2],
      )
      cpd_g = TabularCPD("G", 2, [[0.6], [0.4]])
      self.bayesian_model.add_cpds(
          cpd_a, cpd_g, cpd_j, cpd_l, cpd_q, cpd_r
      )
      self.sampling_inference = BayesianModelSampling(
          self.bayesian_model
      )
      self.forward_marginals = VariableElimination(
          self.bayesian_model
      ).query(
          self.bayesian_model.nodes(), joint=False, show_progress=False
      )
  
      # Bayesian Model without state names and with latent variables
      self.bayesian_model_lat = BayesianNetwork(
          [("A", "J"), ("R", "J"), ("J", "Q"), ("J", "L"), ("G", "L")],
          latents=["R", "Q"],
      )
      cpd_a = TabularCPD("A", 2, [[0.2], [0.8]])
      cpd_r = TabularCPD("R", 2, [[0.4], [0.6]])
      cpd_j = TabularCPD(
          "J",
          2,
          [[0.9, 0.6, 0.7, 0.1], [0.1, 0.4, 0.3, 0.9]],
          ["R", "A"],
          [2, 2],
      )
      cpd_q = TabularCPD("Q", 2, [[0.9, 0.2], [0.1, 0.8]], ["J"], [2])
      cpd_l = TabularCPD(
          "L",
          2,
          [[0.9, 0.45, 0.8, 0.1], [0.1, 0.55, 0.2, 0.9]],
          ["G", "J"],
          [2, 2],
      )
      cpd_g = TabularCPD("G", 2, [[0.6], [0.4]])
      self.bayesian_model_lat.add_cpds(
          cpd_a, cpd_g, cpd_j, cpd_l, cpd_q, cpd_r
      )
      self.sampling_inference_lat = BayesianModelSampling(
          self.bayesian_model_lat
      )
  
      # Bayesian Model with state names
      self.bayesian_model_names = BayesianNetwork(
          [("A", "J"), ("R", "J"), ("J", "Q"), ("J", "L"), ("G", "L")]
      )
      cpd_a_names = TabularCPD(
          "A", 2, [[0.2], [0.8]], state_names={"A": ["a0", "a1"]}
      )
      cpd_r_names = TabularCPD(
          "R", 2, [[0.4], [0.6]], state_names={"R": ["r0", "r1"]}
      )
      cpd_j_names = TabularCPD(
          "J",
          2,
          [[0.9, 0.6, 0.7, 0.1], [0.1, 0.4, 0.3, 0.9]],
          ["R", "A"],
          [2, 2],
          state_names={
              "J": ["j0", "j1"],
              "R": ["r0", "r1"],
              "A": ["a0", "a1"],
          },
      )
      cpd_q_names = TabularCPD(
          "Q",
          2,
          [[0.9, 0.2], [0.1, 0.8]],
          ["J"],
          [2],
          state_names={"Q": ["q0", "q1"], "J": ["j0", "j1"]},
      )
      cpd_l_names = TabularCPD(
          "L",
          2,
          [[0.9, 0.45, 0.8, 0.1], [0.1, 0.55, 0.2, 0.9]],
          ["G", "J"],
          [2, 2],
          state_names={
              "L": ["l0", "l1"],
              "G": ["g0", "g1"],
              "J": ["j0", "j1"],
          },
      )
      cpd_g_names = TabularCPD(
          "G", 2, [[0.6], [0.4]], state_names={"G": ["g0", "g1"]}
      )
      self.bayesian_model_names.add_cpds(
          cpd_a_names,
          cpd_g_names,
          cpd_j_names,
          cpd_l_names,
          cpd_q_names,
          cpd_r_names,
      )
  
      self.sampling_inference_names = BayesianModelSampling(
          self.bayesian_model_names
      )
  
      # Bayesian Model with state names and with latent variables
      self.bayesian_model_names_lat = BayesianNetwork(
          [("A", "J"), ("R", "J"), ("J", "Q"), ("J", "L"), ("G", "L")],
          latents=["R", "Q"],
      )
      cpd_a_names = TabularCPD(
          "A", 2, [[0.2], [0.8]], state_names={"A": ["a0", "a1"]}
      )
      cpd_r_names = TabularCPD(
          "R", 2, [[0.4], [0.6]], state_names={"R": ["r0", "r1"]}
      )
      cpd_j_names = TabularCPD(
          "J",
          2,
          [[0.9, 0.6, 0.7, 0.1], [0.1, 0.4, 0.3, 0.9]],
          ["R", "A"],
          [2, 2],
          state_names={
              "J": ["j0", "j1"],
              "R": ["r0", "r1"],
              "A": ["a0", "a1"],
          },
      )
      cpd_q_names = TabularCPD(
          "Q",
          2,
          [[0.9, 0.2], [0.1, 0.8]],
          ["J"],
          [2],
          state_names={"Q": ["q0", "q1"], "J": ["j0", "j1"]},
      )
      cpd_l_names = TabularCPD(
          "L",
          2,
          [[0.9, 0.45, 0.8, 0.1], [0.1, 0.55, 0.2, 0.9]],
          ["G", "J"],
          [2, 2],
          state_names={
              "L": ["l0", "l1"],
              "G": ["g0", "g1"],
              "J": ["j0", "j1"],
          },
      )
      cpd_g_names = TabularCPD(
          "G", 2, [[0.6], [0.4]], state_names={"G": ["g0", "g1"]}
      )
      self.bayesian_model_names_lat.add_cpds(
          cpd_a_names,
          cpd_g_names,
          cpd_j_names,
          cpd_l_names,
          cpd_q_names,
          cpd_r_names,
      )
  
      self.sampling_inference_names_lat = BayesianModelSampling(
          self.bayesian_model_names_lat
      )
  
      self.markov_model = MarkovNetwork()
  
imports: import unittest
  import numpy
  from mock import MagicMock, patch
  from pgmpy.factors.discrete import DiscreteFactor, State, TabularCPD
  from pgmpy.inference import VariableElimination
  from pgmpy.models import BayesianNetwork, MarkovNetwork
  from pgmpy.sampling import BayesianModelSampling, GibbsSampling
  from pgmpy.sampling.base import BayesianModelInference
label_desc: Use image node_id 1 for calling the TestBayesianModelSampling obj's underlying member method code with example usage: obj.setUp() without return types