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.5472 | 0.4528 | |
| 0.4726 | 0.5274 | ||
|
| 0.3236 | 0.6764 | |
| 0.2619 | 0.7381 | ||
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.3672 | 0.6328 | |
| 0.3117 | 0.6883 | |||
|
| 0.3501 | 0.6499 | ||
| 0.3342 | 0.6658 | |||
|
|
| 0.6782 | 0.3218 | |
| 0.6219 | 0.3781 | |||
|
| 0.6618 | 0.3382 | ||
| 0.6458 | 0.3542 | |||
In [5]:
ie.evidenceImpact("E", ["A", "B", "C", "D", "F"]) # {A,C,D} d-separates E and {B,F}
Out[5]:
|
|
| |||
|---|---|---|---|---|
|
|
| 0.4290 | 0.5710 | |
| 0.2396 | 0.7604 | |||
|
| 0.7318 | 0.2682 | ||
| 0.5336 | 0.4664 | |||
|
|
| 0.2203 | 0.7797 | |
| 0.5601 | 0.4399 | |||
|
| 0.5064 | 0.4936 | ||
| 0.8222 | 0.1778 | |||
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.0143 | 0.0756 | |
| 0.1792 | 0.7309 | |||
|
| 0.0045 | 0.0455 | ||
| 0.0823 | 0.8677 | |||
|
|
| 0.0344 | 0.0501 | |
| 0.4313 | 0.4842 | |||
|
| 0.0132 | 0.0370 | ||
| 0.2434 | 0.7063 | |||

