Skip to content

Some other features in Bayesian inference

Creative Commons LicenseaGrUMinteractive online version

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

import pyagrum as gum
import pyagrum.lib.notebook as gnb
bn = gum.loadBN("res/alarm.bgum")
gnb.showJunctionTreeMap(bn);

svg

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

bn = gum.fastBN("A->B->C->D;A->E->D;F->B;C->H")
ie = gum.LazyPropagation(bn)
bn
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 allows the user to analyze the effect of any variables on any other variables

ie.evidenceImpact("B", ["A", "H"])
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

ie.evidenceImpact("E", ["A", "F", "B", "D"]) # {A,D,B} d-separates E and F
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
ie.evidenceImpact("E", ["A", "B", "C", "D", "F"]) # {A,C,D} d-separates E and {B,F}
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
ie.evidenceJointImpact(["A", "F"], ["B", "C", "D", "E", "H"]) # {B,E} d-separates [A,F] and [C,D,H]
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