BayesNet.check

BayesNet.check()

Check if the BayesNet is consistent (variables, CPT, …)

A distribution is considered normalized if its sum is within pyagrum.config['core','epsilonStandard'] (1e-6 by default) of 1. A sum that is further away but within pyagrum.config['core','epsilonCoarse'] (1e-2 by default) of 1 is reported with the hint ‘(normalization problem ?)’, since it is probably a rounding problem rather than an error in the parameters.

Returns:

the issues found (empty if the Bayesian network is consistent)

Return type:

tuple of str

Example

import pyagrum as gum

bn = gum.fastBN("A->B")
bn.check()
# ()
bn.cpt("A").fillWith([0.3, 0.3])
bn.check()
# ('Variable A : the CPT sum to less than 1.',)

Class

BayesNet