Some other features in Bayesian inference
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);
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]:
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]:
|
|
| ||
|---|---|---|---|
|
| 0.7138 | 0.2862 | |
| 0.6808 | 0.3192 | ||
|
| 0.3047 | 0.6953 | |
| 0.2727 | 0.7273 | ||
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]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.8722 | 0.1278 | |
| 0.9738 | 0.0262 | |||
|
| 0.8865 | 0.1135 | ||
| 0.9767 | 0.0233 | |||
|
|
| 0.5372 | 0.4628 | |
| 0.8636 | 0.1364 | |||
|
| 0.5706 | 0.4294 | ||
| 0.8770 | 0.1230 | |||
In [5]:
ie.evidenceImpact("E",["A","B","C","D","F"]) # {A,C,D} d-separates E and {B,F}
Out[5]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.9066 | 0.0934 | |
| 0.9883 | 0.0117 | |||
|
| 0.6227 | 0.3773 | ||
| 0.9348 | 0.0652 | |||
|
|
| 0.7916 | 0.2084 | |
| 0.9693 | 0.0307 | |||
|
| 0.3925 | 0.6075 | ||
| 0.8428 | 0.1572 | |||
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]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.3206 | 0.0245 | |
| 0.5338 | 0.1210 | |||
|
| 0.4137 | 0.3178 | ||
| 0.0942 | 0.1744 | |||
|
|
| 0.1875 | 0.0843 | |
| 0.3121 | 0.4161 | |||
|
| 0.1216 | 0.5493 | ||
| 0.0277 | 0.3014 | |||

