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]:
anonymousBN A A B B A->B E E A->E C C B->C D D C->D H H C->H E->D F F F->B

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.41460.5854
1
0.45720.5428
1
0
0.10720.8928
1
0.12490.8751

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.32200.6780
1
0.04930.9507
1
0
0.31310.6869
1
0.04210.9579
1
0
0
0.11560.8844
1
0.01410.9859
1
0
0.11150.8885
1
0.01190.9881
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.35920.6408
1
0.06760.9324
1
0
0.13370.8663
1
0.01960.9804
1
0
0
0.29500.7050
1
0.01970.9803
1
0
0.10330.8967
1
0.00550.9945

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.63990.0351
1
0.31970.0054
1
0
0.58170.1353
1
0.21910.0640
1
0
0
0.57820.1152
1
0.28890.0176
1
0
0.38150.3225
1
0.14370.1524