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.4146 | 0.5854 | |
| 0.4572 | 0.5428 | ||
|
| 0.1072 | 0.8928 | |
| 0.1249 | 0.8751 | ||
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.3220 | 0.6780 | |
| 0.0493 | 0.9507 | |||
|
| 0.3131 | 0.6869 | ||
| 0.0421 | 0.9579 | |||
|
|
| 0.1156 | 0.8844 | |
| 0.0141 | 0.9859 | |||
|
| 0.1115 | 0.8885 | ||
| 0.0119 | 0.9881 | |||
In [5]:
ie.evidenceImpact("E", ["A", "B", "C", "D", "F"]) # {A,C,D} d-separates E and {B,F}
Out[5]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.3592 | 0.6408 | |
| 0.0676 | 0.9324 | |||
|
| 0.1337 | 0.8663 | ||
| 0.0196 | 0.9804 | |||
|
|
| 0.2950 | 0.7050 | |
| 0.0197 | 0.9803 | |||
|
| 0.1033 | 0.8967 | ||
| 0.0055 | 0.9945 | |||
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.6399 | 0.0351 | |
| 0.3197 | 0.0054 | |||
|
| 0.5817 | 0.1353 | ||
| 0.2191 | 0.0640 | |||
|
|
| 0.5782 | 0.1152 | |
| 0.2889 | 0.0176 | |||
|
| 0.3815 | 0.3225 | ||
| 0.1437 | 0.1524 | |||

