Click here to hide/show the list of notebooks.
  pyAgrum on notebooks   pyAgrum jupyter
☰  o3prm 
pyAgrum 0.16.2   
Zipped notebooks   
generation: 2019-10-02 10:58  

Creative Commons License
This pyAgrum's notebook is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

In [1]:
import os
os.chdir("res")

import pyAgrum as gum
import pyAgrum.lib.notebook as gnb

Using o3prm syntax for creating BayesNet

In [2]:
bn=gum.loadBN("./Asia.o3prm",verbose=False)
bn
Out[2]:
G visitToAsia visitToAsia tuberculosis tuberculosis visitToAsia->tuberculosis tubOrCancer tubOrCancer tuberculosis->tubOrCancer smoking smoking lungCancer lungCancer smoking->lungCancer bronchitis bronchitis smoking->bronchitis lungCancer->tubOrCancer dyspnea dyspnea bronchitis->dyspnea positiveXRay positiveXRay tubOrCancer->positiveXRay tubOrCancer->dyspnea
In [3]:
bn=gum.loadBN("./aSys.o3prm")
bn
Out[3]:
G A1.Productivity A1.Productivity A1.Cost A1.Cost A1.Productivity->A1.Cost A2.Agg_Productivity A2.Agg_Productivity A1.Productivity->A2.Agg_Productivity A1.Capacity A1.Capacity A1.Capacity->A1.Cost A0.Productivity A0.Productivity A0.Cost A0.Cost A0.Productivity->A0.Cost A0.Productivity->A2.Agg_Productivity A0.Capacity A0.Capacity A0.Capacity->A0.Cost A2.Productivity A2.Productivity A2.Cost A2.Cost A2.Productivity->A2.Cost A2.Capacity A2.Capacity A2.Capacity->A2.Cost A2.Agg_Productivity->A2.Productivity
In [4]:
classpath="./ComplexPrinters"  
filename="./ComplexPrinters/fr/lip6/printers/system.o3prm"

system="Work"
bn=gum.loadBN(filename,system=system,classpath=classpath)
gnb.showInference(bn,size="20")
structs Inference in 7143.38ms bw_printers[6].equipState bw_printers[6].equipState1 bw_printers[6].equipState->bw_printers[6].equipState1 c1.functional_printer bw_printers[6].equipState->c1.functional_printer c1.degraded_printer bw_printers[6].equipState->c1.degraded_printer c2.functional_printer bw_printers[6].equipState->c2.functional_printer c2.degraded_printer bw_printers[6].equipState->c2.degraded_printer bw_printers[6].equipState2 bw_printers[6].equipState1->bw_printers[6].equipState2 bw_printers[6].hasPaper bw_printers[6].hasInk bw_printers[6].hasInk1 bw_printers[6].hasInk1->bw_printers[6].equipState bw_printers[6].hasInk2 bw_printers[6].hasInk1->bw_printers[6].hasInk2 bw_printers[6].hasInk2->bw_printers[6].hasInk bw_printers[6].hasPaper1 bw_printers[6].hasPaper1->bw_printers[6].equipState bw_printers[6].hasPaper2 bw_printers[6].hasPaper1->bw_printers[6].hasPaper2 bw_printers[6].hasPaper2->bw_printers[6].hasPaper bw_printers[9].equipState bw_printers[9].equipState1 bw_printers[9].equipState->bw_printers[9].equipState1 bw_printers[9].equipState->c1.functional_printer bw_printers[9].equipState->c1.degraded_printer bw_printers[9].equipState->c2.functional_printer bw_printers[9].equipState->c2.degraded_printer bw_printers[9].equipState2 bw_printers[9].equipState1->bw_printers[9].equipState2 bw_printers[9].hasPaper bw_printers[9].hasInk bw_printers[9].hasInk1 bw_printers[9].hasInk1->bw_printers[9].equipState bw_printers[9].hasInk2 bw_printers[9].hasInk1->bw_printers[9].hasInk2 bw_printers[9].hasInk2->bw_printers[9].hasInk bw_printers[9].hasPaper1 bw_printers[9].hasPaper1->bw_printers[9].equipState bw_printers[9].hasPaper2 bw_printers[9].hasPaper1->bw_printers[9].hasPaper2 bw_printers[9].hasPaper2->bw_printers[9].hasPaper bw_printers[1].equipState bw_printers[1].equipState1 bw_printers[1].equipState->bw_printers[1].equipState1 bw_printers[1].equipState->c1.functional_printer bw_printers[1].equipState->c1.degraded_printer bw_printers[1].equipState->c2.functional_printer bw_printers[1].equipState->c2.degraded_printer bw_printers[1].equipState2 bw_printers[1].equipState1->bw_printers[1].equipState2 bw_printers[1].hasPaper bw_printers[1].hasInk bw_printers[1].hasInk1 bw_printers[1].hasInk1->bw_printers[1].equipState bw_printers[1].hasInk2 bw_printers[1].hasInk1->bw_printers[1].hasInk2 bw_printers[1].hasInk2->bw_printers[1].hasInk bw_printers[1].hasPaper1 bw_printers[1].hasPaper1->bw_printers[1].equipState bw_printers[1].hasPaper2 bw_printers[1].hasPaper1->bw_printers[1].hasPaper2 bw_printers[1].hasPaper2->bw_printers[1].hasPaper bw_printers[4].equipState bw_printers[4].equipState1