Comparison of Bayesian networks¶

To compare Bayesian network, one can compare the structure of the BNs (see pyAgrum.lib.bn_vs_vb.GraphicalBNComparator). However BNs can also be compared as probability distributions.
- class pyAgrum.ExactBNdistance(*args)¶
Class representing exacte computation of divergence and distance between BNs
- ExactBNdistance(P,Q) -> ExactBNdistance
- Parameters:
P (pyAgrum.BayesNet) a Bayesian network
Q (pyAgrum.BayesNet) another Bayesian network to compare with the first one
- ExactBNdistance(ebnd) -> ExactBNdistance
- Parameters:
ebnd (pyAgrum.ExactBNdistance) the exact BNdistance to copy
- Raises
pyAgrum.OperationNotAllowed – If the 2BNs have not the same domain size of compatible node sets
- compute()¶
- Returns
a dictionnary containing the different values after the computation.
- Return type
Dict[str,float]
- class pyAgrum.GibbsBNdistance(*args)¶
Class representing a Gibbs-Approximated computation of divergence and distance between BNs
- GibbsBNdistance(P,Q) -> GibbsBNdistance
- Parameters:
P (pyAgrum.BayesNet) – a Bayesian network
Q (pyAgrum.BayesNet) – another Bayesian network to compare with the first one
- GibbsBNdistance(gbnd) -> GibbsBNdistance
- Parameters:
gbnd (pyAgrum.GibbsBNdistance) – the Gibbs BNdistance to copy
- Raises
pyAgrum.OperationNotAllowed – If the 2BNs have not the same domain size of compatible node sets
- burnIn()¶
- Returns
size of burn in on number of iteration
- Return type
int
- compute()¶
- Returns
a dictionnary containing the different values after the computation.
- Return type
Dict[str,float]
- continueApproximationScheme(error)¶
Continue the approximation scheme.
- Parameters
error (float) –
- Return type
bool
- currentTime()¶
- Returns
get the current running time in second (float)
- Return type
float
- disableEpsilon()¶
Disable epsilon as a stopping criterion.
- Return type
None
- disableMaxIter()¶
Disable max iterations as a stopping criterion.
- Return type
None
- disableMaxTime()¶
Disable max time as a stopping criterion.
- Return type
None
- disableMinEpsilonRate()¶
Disable a min epsilon rate as a stopping criterion.
- Return type
None
- enableEpsilon()¶
Enable epsilon as a stopping criterion.
- Return type
None
- enableMaxIter()¶
Enable max iterations as a stopping criterion.
- Return type
None
- enableMaxTime()¶
Enable max time as a stopping criterion.
- Return type
None
- enableMinEpsilonRate()¶
Enable a min epsilon rate as a stopping criterion.
- Return type
None
- epsilon()¶
- Returns
the value of epsilon
- Return type
float
- history()¶
- Returns
the scheme history
- Return type
tuple
- Raises
pyAgrum.OperationNotAllowed – If the scheme did not performed or if verbosity is set to false
- initApproximationScheme()¶
Initiate the approximation scheme.
- Return type
None
- isDrawnAtRandom()¶
- Returns
True if variables are drawn at random
- Return type
bool
- isEnabledEpsilon()¶
- Returns
True if epsilon is used as a stopping criterion.
- Return type
bool
- isEnabledMaxIter()¶
- Returns
True if max iterations is used as a stopping criterion
- Return type
bool
- isEnabledMaxTime()¶
- Returns
True if max time is used as a stopping criterion
- Return type
bool
- isEnabledMinEpsilonRate()¶
- Returns
True if epsilon rate is used as a stopping criterion
- Return type
bool
- maxIter()¶
- Returns
the criterion on number of iterations
- Return type
int
- maxTime()¶
- Returns
the timeout(in seconds)
- Return type
float
- messageApproximationScheme()¶
- Returns
the approximation scheme message
- Return type
str
- minEpsilonRate()¶
- Returns
the value of the minimal epsilon rate
- Return type
float
- nbrDrawnVar()¶
- Returns
the number of variable drawn at each iteration
- Return type
int
- nbrIterations()¶
- Returns
the number of iterations
- Return type
int
- periodSize()¶
- Returns
the number of samples between 2 stopping
- Return type
int
- Raises
pyAgrum.OutOfBounds – If p<1
- remainingBurnIn()¶
- Returns
the number of remaining burn in
- Return type
int
- setBurnIn(b)¶
- Parameters
b (int) – size of burn in on number of iteration
- Return type
None
- setDrawnAtRandom(_atRandom)¶
- Parameters
_atRandom (bool) – indicates if variables should be drawn at random
- Return type
None
- setEpsilon(eps)¶
- Parameters
eps (float) – the epsilon we want to use
- Raises
pyAgrum.OutOfBounds – If eps<0
- Return type
None
- setMaxIter(max)¶
- Parameters
max (int) – the maximum number of iteration
- Raises
pyAgrum.OutOfBounds – If max <= 1
- Return type
None
- setMaxTime(timeout)¶
- Parameters
tiemout (float) – stopping criterion on timeout (in seconds)
timeout (
float
) –
- Raises
pyAgrum.OutOfBounds – If timeout<=0.0
- Return type
None
- setMinEpsilonRate(rate)¶
- Parameters
rate (float) – the minimal epsilon rate
- Return type
None
- setNbrDrawnVar(_nbr)¶
- Parameters
_nbr (int) – the number of variables to be drawn at each iteration
- Return type
None
- setPeriodSize(p)¶
- Parameters
p (int) – number of samples between 2 stopping
- Raises
pyAgrum.OutOfBounds – If p<1
- Return type
None
- setVerbosity(v)¶
- Parameters
v (bool) – verbosity
- Return type
None
- startOfPeriod()¶
- Returns
True if it is a start of a period
- Return type
bool
- stateApproximationScheme()¶
- Returns
the state of the approximation scheme
- Return type
int
- stopApproximationScheme()¶
Stop the approximation scheme.
- Return type
None
- updateApproximationScheme(incr=1)¶
Update the approximation scheme.
- Parameters
incr (
int
) –- Return type
None
- verbosity()¶
- Returns
True if the verbosity is enabled
- Return type
bool