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.0841 | 0.9159 | |
| 0.1104 | 0.8896 | ||
|
| 0.5675 | 0.4325 | |
| 0.6396 | 0.3604 | ||
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.5582 | 0.4418 | |
| 0.2303 | 0.7697 | |||
|
| 0.5830 | 0.4170 | ||
| 0.1880 | 0.8120 | |||
|
|
| 0.8034 | 0.1966 | |
| 0.4918 | 0.5082 | |||
|
| 0.8189 | 0.1811 | ||
| 0.4282 | 0.5718 | |||
In [5]:
ie.evidenceImpact("E", ["A", "B", "C", "D", "F"]) # {A,C,D} d-separates E and {B,F}
Out[5]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.6455 | 0.3545 | |
| 0.0600 | 0.9400 | |||
|
| 0.8548 | 0.1452 | ||
| 0.1711 | 0.8289 | |||
|
|
| 0.4814 | 0.5186 | |
| 0.3389 | 0.6611 | |||
|
| 0.7502 | 0.2498 | ||
| 0.6238 | 0.3762 | |||
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.0974 | 0.7268 | |
| 0.1018 | 0.0740 | |||
|
| 0.7291 | 0.1911 | ||
| 0.0514 | 0.0283 | |||
|
|
| 0.2180 | 0.5029 | |
| 0.2279 | 0.0512 | |||
|
| 0.8594 | 0.0696 | ||
| 0.0606 | 0.0103 | |||

