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.3347 | 0.6653 | |
| 0.2379 | 0.7621 | ||
|
| 0.2680 | 0.7320 | |
| 0.1852 | 0.8148 | ||
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.9995 | 0.0005 | |
| 0.9995 | 0.0005 | |||
|
| 0.9992 | 0.0008 | ||
| 0.9996 | 0.0004 | |||
|
|
| 0.2079 | 0.7921 | |
| 0.2048 | 0.7952 | |||
|
| 0.1419 | 0.8581 | ||
| 0.2690 | 0.7310 | |||
In [5]:
ie.evidenceImpact("E", ["A", "B", "C", "D", "F"]) # {A,C,D} d-separates E and {B,F}
Out[5]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.9996 | 0.0004 | |
| 0.9992 | 0.0008 | |||
|
| 0.2616 | 0.7384 | ||
| 0.1463 | 0.8537 | |||
|
|
| 0.9991 | 0.0009 | |
| 0.9997 | 0.0003 | |||
|
| 0.1273 | 0.8727 | ||
| 0.2821 | 0.7179 | |||
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.3270 | 0.0026 | |
| 0.6323 | 0.0380 | |||
|
| 0.4284 | 0.0288 | ||
| 0.5166 | 0.0262 | |||
|
|
| 0.0011 | 0.0648 | |
| 0.0021 | 0.9320 | |||
|
| 0.0011 | 0.5227 | ||
| 0.0013 | 0.4750 | |||

