Some other features in Bayesian inference

Creative Commons License

aGrUM

interactive online version

Lazy Propagation uses a secondary structure called the “Junction Tree” to perform the inference.

In [1]:
import pyagrum as gum
import pyagrum.lib.notebook as gnb

bn = gum.loadBN("res/alarm.bgum")
gnb.showJunctionTreeMap(bn);
../_images/notebooks_43-Inference_LazyPropagationAdvancedFeatures_3_0.svg

But this junction tree can be transformed to build different probabilistic queries.

In [2]:
bn = gum.fastBN("A->B->C->D;A->E->D;F->B;C->H")
ie = gum.LazyPropagation(bn)
bn
Out[2]:
G H H B B C C B->C D D F F F->B E E E->D C->H C->D A A A->B A->E

Evidence impact

Evidence Impact allows the user to analyze the effect of any variables on any other variables

In [3]:
ie.evidenceImpact("B", ["A", "H"])
Out[3]:
B
A
H
0
1
0
0
0.33470.6653
1
0.23790.7621
1
0
0.26800.7320
1
0.18520.8148

Evidence impact is able to find the minimum set of variables which effectively conditions the analyzed variable

In [4]:
ie.evidenceImpact("E", ["A", "F", "B", "D"])  # {A,D,B} d-separates E and F
Out[4]:
E
A
B
D
0
1
0
0
0
0.99950.0005
1
0.99950.0005
1
0
0.99920.0008
1
0.99960.0004
1
0
0
0.20790.7921
1
0.20480.7952
1
0
0.14190.8581
1
0.26900.7310
In [5]:
ie.evidenceImpact("E", ["A", "B", "C", "D", "F"])  # {A,C,D} d-separates E and {B,F}
Out[5]:
E
C
A
D
0
1
0
0
0
0.99960.0004
1
0.99920.0008
1
0
0.26160.7384
1
0.14630.8537
1
0
0
0.99910.0009
1
0.99970.0003
1
0
0.12730.8727
1
0.28210.7179

Evidence Joint Impact

In [6]:
ie.evidenceJointImpact(["A", "F"], ["B", "C", "D", "E", "H"])  # {B,E} d-separates [A,F] and [C,D,H]
Out[6]:
A
E
B
F
0
1
0
0
0
0.32700.0026
1
0.63230.0380
1
0
0.42840.0288
1
0.51660.0262
1
0
0
0.00110.0648
1
0.00210.9320
1
0
0.00110.5227
1
0.00130.4750