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.dsl")
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 B B C C B->C F F F->B H H A A A->B E E A->E D D E->D C->H C->D

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.12410.8759
1
0.13260.8674
1
0
0.53100.4690
1
0.54990.4501

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.28550.7145
1
0.26270.7373
1
0
0.28310.7169
1
0.26610.7339
1
0
0
0.72510.2749
1
0.70170.2983
1
0
0.72280.2772
1
0.70540.2946
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.27580.7242
1
0.27660.7234
1
0
0.71550.2845
1
0.71630.2837
1
0
0
0.29590.7041
1
0.24640.7536
1
0
0.73520.2648
1
0.68350.3165

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.00680.0127
1
0.01470.9658
1
0
0.00960.1643
1
0.13950.6866
1
0
0
0.03990.0113
1
0.08660.8622
1
0
0.03440.0895
1
0.50200.3740