-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCase3_an.py
54 lines (40 loc) · 1.38 KB
/
Case3_an.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from BlankCase import *
class Case3_an(BlankCase):
"""
The constructor for this class should use the following dot_file_path.
See docstring for class BlankCase for more info.
dot_atlas/case3_an.dot
Attributes
----------
"""
def __init__(self, dot_file_path, emp_probs=None):
BlankCase.__init__(self, dot_file_path, emp_probs=emp_probs)
def get_truth_bnet(self):
"""
This method returns an instance of TruthBayesNet
Returns
-------
TruthBayesNet
"""
# choose any dag from dag_list and add legal structure to its dot
dag = self.dag_list[0]
dot_addition = ''
enhanced_dot = dag.basic_dot.replace("{", "{" + dot_addition)
dag = DAG("truth_dag", enhanced_dot)
# print("qqwwee", dag.nodes, dag.arrows)
print("\nWe are choosing a truth bnet with the same structure as G_1")
nd_to_size = {}
for nd in dag.nodes:
nd_to_size[nd] = 2
nd_to_size["a"] = 3
bnet = TruthBayesNet.create_random_bnet(
dag.nodes,
dag.arrows,
nd_to_size)
truth_bnet = TruthBayesNet(bnet)
return truth_bnet
if __name__ == "__main__":
def main(jupyter, draw):
case = Case3_an("dot_atlas/case3_an.dot")
case.run(jupyter=jupyter, draw=draw)
main(jupyter=False, draw=True)