code: def setUp(self):
      self.dbn = DBN()
      self.dbn.add_edges_from(
          [
              (("D", 0), ("G", 0)),
              (("I", 0), ("G", 0)),
              (("D", 0), ("D", 1)),
              (("I", 0), ("I", 1)),
          ]
      )
      diff_cpd = TabularCPD(("D", 0), 2, [[0.6], [0.4]])
      grade_cpd = TabularCPD(
          ("G", 0),
          3,
          [
              [0.3, 0.05, 0.9, 0.5],
              [0.4, 0.25, 0.08, 0.3],
              [0.3, 0.7, 0.02, 0.2],
          ],
          evidence=[("I", 0), ("D", 0)],
          evidence_card=[2, 2],
      )
      d_i_cpd = TabularCPD(
          ("D", 1),
          2,
          [[0.6, 0.3], [0.4, 0.7]],
          evidence=[("D", 0)],
          evidence_card=[2],
      )
      intel_cpd = TabularCPD(("I", 0), 2, [[0.7], [0.3]])
      i_i_cpd = TabularCPD(
          ("I", 1),
          2,
          [[0.5, 0.4], [0.5, 0.6]],
          evidence=[("I", 0)],
          evidence_card=[2],
      )
      g_i_cpd = TabularCPD(
          ("G", 1),
          3,
          [
              [0.3, 0.05, 0.9, 0.5],
              [0.4, 0.25, 0.08, 0.3],
              [0.3, 0.7, 0.02, 0.2],
          ],
          evidence=[("I", 1), ("D", 1)],
          evidence_card=[2, 2],
      )
      self.dbn.add_cpds(
          diff_cpd, grade_cpd, d_i_cpd, intel_cpd, i_i_cpd, g_i_cpd
      )
  
      self.dbn_infer = DBNInference(self.dbn)
  
      # Construct an equivalent simple BN to match values to
      self.equivalent_bn = BayesianNetwork(
          [
              ("D0", "G0"),
              ("I0", "G0"),
              ("D0", "D1"),
              ("I0", "I1"),
              ("D1", "G1"),
              ("I1", "G1"),
              ("D1", "D2"),
              ("I1", "I2"),
              ("D2", "G2"),
              ("I2", "G2"),
          ]
      )
      d0_cpd = TabularCPD("D0", 2, [[0.6], [0.4]])
      i0_cpd = TabularCPD("I0", 2, [[0.7], [0.3]])
      g0_cpd = TabularCPD(
          "G0",
          3,
          [
              [0.3, 0.05, 0.9, 0.5],
              [0.4, 0.25, 0.08, 0.3],
              [0.3, 0.7, 0.02, 0.2],
          ],
          evidence=["I0", "D0"],
          evidence_card=[2, 2],
      )
      d1_cpd = TabularCPD(
          "D1",
          2,
          [[0.6, 0.3], [0.4, 0.7]],
          evidence=["D0"],
          evidence_card=[2],
      )
      i1_cpd = TabularCPD(
          "I1",
          2,
          [[0.5, 0.4], [0.5, 0.6]],
          evidence=["I0"],
          evidence_card=[2],
      )
      g1_cpd = TabularCPD(
          "G1",
          3,
          [
              [0.3, 0.05, 0.9, 0.5],
              [0.4, 0.25, 0.08, 0.3],
              [0.3, 0.7, 0.02, 0.2],
          ],
          evidence=["I1", "D1"],
          evidence_card=[2, 2],
      )
      d2_cpd = TabularCPD(
          "D2",
          2,
          [[0.6, 0.3], [0.4, 0.7]],
          evidence=["D1"],
          evidence_card=[2],
      )
      i2_cpd = TabularCPD(
          "I2",
          2,
          [[0.5, 0.4], [0.5, 0.6]],
          evidence=["I1"],
          evidence_card=[2],
      )
      g2_cpd = TabularCPD(
          "G2",
          3,
          [
              [0.3, 0.05, 0.9, 0.5],
              [0.4, 0.25, 0.08, 0.3],
              [0.3, 0.7, 0.02, 0.2],
          ],
          evidence=["I2", "D2"],
          evidence_card=[2, 2],
      )
      self.equivalent_bn.add_cpds(
          d0_cpd,
          i0_cpd,
          g0_cpd,
          d1_cpd,
          i1_cpd,
          g1_cpd,
          d2_cpd,
          i2_cpd,
          g2_cpd,
      )
      self.bn_infer = VariableElimination(self.equivalent_bn)
      self.bn_causal_infer = CausalInference(self.equivalent_bn)
  
imports: import unittest
  import numpy
  import numpy.testing
  import pandas
  import pgmpy.tests.help_functions
  from pgmpy.factors.discrete import TabularCPD
  from pgmpy.inference import CausalInference, DBNInference, VariableElimination
  from pgmpy.models import BayesianNetwork
  from pgmpy.models import DynamicBayesianNetwork
label_desc: Use image node_id 1 for calling the TestDBNSampling obj's underlying member method code with example usage: obj.setUp() without return types