code: def test_simulate_virtual_evidence(self):
      virtual_evidence = [
          TabularCPD(("D", 0), 2, [[0.2], [0.8]]),
          TabularCPD(("D", 2), 2, [[0.8], [0.2]]),
      ]
      bn_virtual_evidence = [
          TabularCPD("D0", 2, [[0.2], [0.8]]),
          TabularCPD("D2", 2, [[0.8], [0.2]]),
      ]
      samples = self.dbn.simulate(
          n_samples=int(1e5),
          n_time_slices=3,
          virtual_evidence=virtual_evidence,
          show_progress=False,
      )
      self.assertEqual(len(samples), int(1e5))
      self.assertEqual(len(samples.columns), 9)
      for node in [
          ("D", 0),
          ("I", 0),
          ("G", 0),
          ("D", 1),
          ("I", 1),
          ("G", 1),
          ("D", 2),
          ("I", 2),
          ("G", 2),
      ]:
          self.assertIn(node, samples.columns)
  
      self.assertTrue(
          sorted(np.unique(samples.loc[:, [("D", 0)]].values)), [0, 1]
      )
      self.assertTrue(
          sorted(np.unique(samples.loc[:, [("I", 0)]].values)), [0, 1]
      )
      self.assertTrue(
          sorted(np.unique(samples.loc[:, [("G", 0)]].values)),
          [0, 1, 2],
      )
      self.assertTrue(
          sorted(np.unique(samples.loc[:, [("D", 1)]].values)), [0, 1]
      )
      self.assertTrue(
          sorted(np.unique(samples.loc[:, [("I", 1)]].values)), [0, 1]
      )
      self.assertTrue(
          sorted(np.unique(samples.loc[:, [("G", 1)]].values)),
          [0, 1, 2],
      )
      self.assertTrue(
          sorted(np.unique(samples.loc[:, [("D", 2)]].values)), [0, 1]
      )
      self.assertTrue(
          sorted(np.unique(samples.loc[:, [("I", 2)]].values)), [0, 1]
      )
      self.assertTrue(
          sorted(np.unique(samples.loc[:, [("G", 2)]].values)),
          [0, 1, 2],
      )
  
      # Test the asymptotic distribution of samples
      sample_marginals = {
          node: samples.loc[:, [node.to_tuple()]].value_counts()
          / samples.shape[0]
          for node in self.dbn.nodes()
      }
  
      for node in sample_marginals.keys():
          samples_cpd = sample_marginals[node]
          bn_infer_cpd = self.bn_infer.query(
              [str(node[0]) + str(node[1])],
              virtual_evidence=bn_virtual_evidence,
          )
  
          for state in range(samples_cpd.shape[0]):
              self.assertTrue(
                  np.isclose(
                      sample_marginals[node].loc[state].values[0],
                      bn_infer_cpd.values[state],
                      atol=0.05,
                  )
              )
  
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 6 for calling the TestDBNSampling obj's underlying member method code with example usage: obj.test_simulate_virtual_evidence() without return types