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.bgum")
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.5340 | 0.4660 | |
| 0.5701 | 0.4299 | ||
|
| 0.0946 | 0.9054 | |
| 0.1079 | 0.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]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.5002 | 0.4998 | |
| 0.6362 | 0.3638 | |||
|
| 0.5057 | 0.4943 | ||
| 0.6264 | 0.3736 | |||
|
|
| 0.7185 | 0.2815 | |
| 0.8168 | 0.1832 | |||
|
| 0.7228 | 0.2772 | ||
| 0.8104 | 0.1896 | |||
In [5]:
ie.evidenceImpact("E", ["A", "B", "C", "D", "F"]) # {A,C,D} d-separates E and {B,F}
Out[5]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.5176 | 0.4824 | |
| 0.6051 | 0.3949 | |||
|
| 0.7323 | 0.2677 | ||
| 0.7962 | 0.2038 | |||
|
|
| 0.4453 | 0.5547 | |
| 0.7369 | 0.2631 | |||
|
| 0.6717 | 0.3283 | ||
| 0.8772 | 0.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]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.5580 | 0.0310 | |
| 0.0408 | 0.3703 | |||
|
| 0.1029 | 0.8706 | ||
| 0.0168 | 0.0097 | |||
|
|
| 0.7379 | 0.0161 | |
| 0.0539 | 0.1921 | |||
|
| 0.2213 | 0.7344 | ||
| 0.0362 | 0.0082 | |||

