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 E E D D E->D A A A->E B B A->B C C B->C H H C->H C->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.54720.4528
1
0.47260.5274
1
0
0.32360.6764
1
0.26190.7381

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.36720.6328
1
0.31170.6883
1
0
0.35010.6499
1
0.33420.6658
1
0
0
0.67820.3218
1
0.62190.3781
1
0
0.66180.3382
1
0.64580.3542
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.42900.5710
1
0.23960.7604
1
0
0.73180.2682
1
0.53360.4664
1
0
0
0.22030.7797
1
0.56010.4399
1
0
0.50640.4936
1
0.82220.1778
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.01430.0756
1
0.17920.7309
1
0
0.00450.0455
1
0.08230.8677
1
0
0
0.03440.0501
1
0.43130.4842
1
0
0.01320.0370
1
0.24340.7063