Beispiel #1
0
#      ____|______             
#      |_E,_B,_C_|
#         C3                
#
#
###############################################

# We can define a clique tree
from pgmpy.models import JunctionTree
junction_tree = JunctionTree()

# each node in the junction tree is a cluster of random variables
# represented as a tuple
junction_tree.add_nodes_from([('A','B','C'),
	                          ('C','D')])
junction_tree.add_edges(('A', 'B', 'C'),
	                    ('C', 'D')) # Must has variable overlap between two cluster



# Create Clique Tree from a Model class
from pgmpy.models import BayesianModel, MarkovModel
from pgmpy.factors import TabularCPD, Factor

# Create a Bayesian Model
model = BayesianModel(....)

cpd_var1 = TabularCPD(....)
cpd_var2 = TabularCPD(....)
cpd_var3 = TabularCPD(....)
cpd_var4 = TabularCPD(....)
cpd_var5 = TabularCPD(....)