docstr: +------+-------+----------+
  | Node | Value | Marginal |
  +------+-------+----------+
  | a    | False | 0.500000 |
  | a    | True  | 0.500000 |
  | b    | False | 0.550000 |
  | b    | True  | 0.450000 |
  | c    | False | 0.550000 |
  | c    | True  | 0.450000 |
  | d    | False | 0.320000 |
  | d    | True  | 0.680000 |
  | e    | False | 0.535000 |
  | e    | True  | 0.465000 |
  | f    | False | 0.823694 |
  | f    | True  | 0.176306 |
  | g    | False | 0.585000 |
  | g    | True  | 0.415000 |
  | h    | False | 0.176900 |
  | h    | True  | 0.823100 |
  +------+-------+----------+
docstr_tok: ["+","--","--","--","+","--","--","--","-+","--","--","--","--","--","+","|","Node","|","Value","|","Marginal","|","+","--","--","--","+","--","--","--","-+","--","--","--","--","--","+","|","a","|","False","|","0.500000","|","|","a","|","True","|","0.500000","|","|","b","|","False","|","0.550000","|","|","b","|","True","|","0.450000","|","|","c","|","False","|","0.550000","|","|","c","|","True","|","0.450000","|","|","d","|","False","|","0.320000","|","|","d","|","True","|","0.680000","|","|","e","|","False","|","0.535000","|","|","e","|","True","|","0.465000","|","|","f","|","False","|","0.823694","|","|","f","|","True","|","0.176306","|","|","g","|","False","|","0.585000","|","|","g","|","True","|","0.415000","|","|","h","|","False","|","0.176900","|","|","h","|","True","|","0.823100","|","+","--","--","--","+","--","--","--","-+","--","--","--","--","--","+"]
code: def test_marginal(self, huang_darwiche_jt, huang_darwiche_dag):
      # The remaining marginals here come
      # from the module itself, however they
      # have been corrobarted by running
      # inference using the sampling inference
      # engine and the same results are
      # achieved.
      """
      +------+-------+----------+
      | Node | Value | Marginal |
      +------+-------+----------+
      | a    | False | 0.500000 |
      | a    | True  | 0.500000 |
      | b    | False | 0.550000 |
      | b    | True  | 0.450000 |
      | c    | False | 0.550000 |
      | c    | True  | 0.450000 |
      | d    | False | 0.320000 |
      | d    | True  | 0.680000 |
      | e    | False | 0.535000 |
      | e    | True  | 0.465000 |
      | f    | False | 0.823694 |
      | f    | True  | 0.176306 |
      | g    | False | 0.585000 |
      | g    | True  | 0.415000 |
      | h    | False | 0.176900 |
      | h    | True  | 0.823100 |
      +------+-------+----------+
      """
      bbn_nodes = {node.name: node for node in huang_darwiche_dag.nodes}
      assignments = huang_darwiche_jt.assign_clusters(
          huang_darwiche_dag
      )
      huang_darwiche_jt.initialize_potentials(
          assignments, huang_darwiche_dag
      )
      huang_darwiche_jt.propagate()
  
      # These test values come directly from
      # pg. 22 of H & D
      p_A = huang_darwiche_jt.marginal(bbn_nodes["f_a"])
      assert r3(p_A[(("a", True),)]) == 0.5
      assert r3(p_A[(("a", False),)]) == 0.5
  
      p_D = huang_darwiche_jt.marginal(bbn_nodes["f_d"])
      assert r3(p_D[(("d", True),)]) == 0.68
      assert r3(p_D[(("d", False),)]) == 0.32
  
      p_B = huang_darwiche_jt.marginal(bbn_nodes["f_b"])
      assert r3(p_B[(("b", True),)]) == 0.45
      assert r3(p_B[(("b", False),)]) == 0.55
  
      p_C = huang_darwiche_jt.marginal(bbn_nodes["f_c"])
      assert r3(p_C[(("c", True),)]) == 0.45
      assert r3(p_C[(("c", False),)]) == 0.55
  
      p_E = huang_darwiche_jt.marginal(bbn_nodes["f_e"])
      assert r3(p_E[(("e", True),)]) == 0.465
      assert r3(p_E[(("e", False),)]) == 0.535
  
      p_F = huang_darwiche_jt.marginal(bbn_nodes["f_f"])
      assert r3(p_F[(("f", True),)]) == 0.176
      assert r3(p_F[(("f", False),)]) == 0.824
  
      p_G = huang_darwiche_jt.marginal(bbn_nodes["f_g"])
      assert r3(p_G[(("g", True),)]) == 0.415
      assert r3(p_G[(("g", False),)]) == 0.585
  
      p_H = huang_darwiche_jt.marginal(bbn_nodes["f_h"])
      assert r3(p_H[(("h", True),)]) == 0.823
      assert r3(p_H[(("h", False),)]) == 0.177
  
imports: from __future__ import division
  import copy
  from collections import Counter
  import pytest
  from causalnex.ebaybbn import BBNNode, JoinTree, JoinTreeCliqueNode, SepSet, build_bbn, build_bbn_from_conditionals, build_join_tree, combinations, make_moralized_copy, make_node_func, make_undirected_copy, priority_func, triangulate
  from causalnex.ebaybbn.exceptions import VariableNotInGraphError, VariableValueNotInDomainError
  from causalnex.ebaybbn.graph import Node, UndirectedNode
  from causalnex.ebaybbn.utils import get_args, get_original_factors, make_key
label_desc: Use image node_id 12 for calling the TestBBN obj's underlying member method code with example usage: obj.test_marginal(huang_darwiche_jt, huang_darwiche_dag) without return types