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.53400.4660
1
0.57010.4299
1
0
0.09460.9054
1
0.10790.8921

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.50020.4998
1
0.63620.3638
1
0
0.50570.4943
1
0.62640.3736
1
0
0
0.71850.2815
1
0.81680.1832
1
0
0.72280.2772
1
0.81040.1896
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.51760.4824
1
0.60510.3949
1
0
0.73230.2677
1
0.79620.2038
1
0
0
0.44530.5547
1
0.73690.2631
1
0
0.67170.3283
1
0.87720.1228

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.55800.0310
1
0.04080.3703
1
0
0.10290.8706
1
0.01680.0097
1
0
0
0.73790.0161
1
0.05390.1921
1
0
0.22130.7344
1
0.03620.0082