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
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 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.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

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.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
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.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
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.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