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 E E D D E->D H H C C C->D C->H A A A->E B B A->B B->C 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.30040.6996
1
0.29140.7086
1
0
0.50630.4937
1
0.49550.5045

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.32610.6739
1
0.73600.2640
1
0
0.39980.6002
1
0.68460.3154
1
0
0
0.02710.9729
1
0.13840.8616
1
0
0.03700.9630
1
0.11120.8888
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.14340.8566
1
0.86420.1358
1
0
0.00960.9904
1
0.26840.7316
1
0
0
0.47200.5280
1
0.63440.3656
1
0
0.04900.9510
1
0.09090.9091

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.06950.0044
1
0.77470.1515
1
0
0.00790.0023
1
0.92040.0694
1
0
0
0.01960.0214
1
0.21830.7407
1
0
0.00360.0186
1
0.42350.5542