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.3004 | 0.6996 | |
| 0.2914 | 0.7086 | ||
|
| 0.5063 | 0.4937 | |
| 0.4955 | 0.5045 | ||
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.3261 | 0.6739 | |
| 0.7360 | 0.2640 | |||
|
| 0.3998 | 0.6002 | ||
| 0.6846 | 0.3154 | |||
|
|
| 0.0271 | 0.9729 | |
| 0.1384 | 0.8616 | |||
|
| 0.0370 | 0.9630 | ||
| 0.1112 | 0.8888 | |||
In [5]:
ie.evidenceImpact("E", ["A", "B", "C", "D", "F"]) # {A,C,D} d-separates E and {B,F}
Out[5]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.1434 | 0.8566 | |
| 0.8642 | 0.1358 | |||
|
| 0.0096 | 0.9904 | ||
| 0.2684 | 0.7316 | |||
|
|
| 0.4720 | 0.5280 | |
| 0.6344 | 0.3656 | |||
|
| 0.0490 | 0.9510 | ||
| 0.0909 | 0.9091 | |||
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.0695 | 0.0044 | |
| 0.7747 | 0.1515 | |||
|
| 0.0079 | 0.0023 | ||
| 0.9204 | 0.0694 | |||
|
|
| 0.0196 | 0.0214 | |
| 0.2183 | 0.7407 | |||
|
| 0.0036 | 0.0186 | ||
| 0.4235 | 0.5542 | |||

