code: def setUp(self) -> None:
      # construct a tree graph structure
      model = BayesianNetwork(
          [("A", "B"), ("A", "C"), ("B", "D"), ("B", "E"), ("C", "F")]
      )
  
      # add CPD to each edge
      cpd_a = TabularCPD("A", 2, [[0.4], [0.6]])
      cpd_b = TabularCPD(
          "B",
          3,
          [[0.6, 0.2], [0.3, 0.5], [0.1, 0.3]],
          evidence=["A"],
          evidence_card=[2],
      )
      cpd_c = TabularCPD(
          "C",
          2,
          [[0.3, 0.4], [0.7, 0.6]],
          evidence=["A"],
          evidence_card=[2],
      )
      cpd_d = TabularCPD(
          "D",
          3,
          [[0.5, 0.3, 0.1], [0.4, 0.4, 0.8], [0.1, 0.3, 0.1]],
          evidence=["B"],
          evidence_card=[3],
      )
      cpd_e = TabularCPD(
          "E",
          2,
          [[0.3, 0.5, 0.2], [0.7, 0.5, 0.8]],
          evidence=["B"],
          evidence_card=[3],
      )
      cpd_f = TabularCPD(
          "F",
          3,
          [[0.3, 0.6], [0.5, 0.2], [0.2, 0.2]],
          evidence=["C"],
          evidence_card=[2],
      )
      model.add_cpds(cpd_a, cpd_b, cpd_c, cpd_d, cpd_e, cpd_f)
  
      """ transposed conditional probabilities
          C {(0,): array([0.3, 0.7]), (1,): array([0.4, 0.6])}
          F {(0,): array([0.3, 0.5, 0.2]), (1,): array([0.6, 0.2, 0.2])}
          B {(0,): array([0.6, 0.3, 0.1]), (1,): array([0.2, 0.5, 0.3])}
          E {(0,): array([0.3, 0.7]), (1,): array([0.5, 0.5]), (2,): array([0.2, 0.8])}
          D {(0,): array([0.5, 0.4, 0.1]), (1,): array([0.3, 0.4, 0.3]), (2,): array([0.1, 0.8, 0.1])}
          """
      self.model = model
      self.inference = BayesianModelProbability(model)
  
file_path: pgmpy/pgmpy/tests/test_inference/test_bn_inference.py
imports: import unittest
  import numpy
  import pandas
  from pgmpy.models import BayesianNetwork
  from pgmpy.metrics import BayesianModelProbability
  from pgmpy.factors.discrete import TabularCPD
label_desc: Use image node_id 1 for calling the TestBnInference obj's underlying member method code with example usage: obj.setUp() without return types