Comparison of Bayesian networks

tools for comparing 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:gum.OperationNotAllowed – If the 2BNs have not the same domain size of compatible node sets
compute(self)
Returns:a dictionnary containing the different values after the computation.
Return type:dict
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:gum.OperationNotAllowed – If the 2BNs have not the same domain size of compatible node sets
burnIn(self)
Returns:size of burn in on number of iteration
Return type:int
compute(self)
Returns:a dictionnary containing the different values after the computation.
Return type:dict
continueApproximationScheme(self, error)

Continue the approximation scheme.

Parameters:error (double) –
currentTime(self)
Returns:get the current running time in second (double)
Return type:double
disableEpsilon(self)

Disable epsilon as a stopping criterion.

disableMaxIter(self)

Disable max iterations as a stopping criterion.

disableMaxTime(self)

Disable max time as a stopping criterion.

disableMinEpsilonRate(self)

Disable a min epsilon rate as a stopping criterion.

enableEpsilon(self)

Enable epsilon as a stopping criterion.

enableMaxIter(self)

Enable max iterations as a stopping criterion.

enableMaxTime(self)

Enable max time as a stopping criterion.

enableMinEpsilonRate(self)

Enable a min epsilon rate as a stopping criterion.

epsilon(self)
Returns:the value of epsilon
Return type:double
history(self)
Returns:the scheme history
Return type:tuple
Raises:gum.OperationNotAllowed – If the scheme did not performed or if verbosity is set to false
initApproximationScheme(self)

Initiate the approximation scheme.

isDrawnAtRandom(self)
Returns:True if variables are drawn at random
Return type:bool
isEnabledEpsilon(self)
Returns:True if epsilon is used as a stopping criterion.
Return type:bool
isEnabledMaxIter(self)
Returns:True if max iterations is used as a stopping criterion
Return type:bool
isEnabledMaxTime(self)
Returns:True if max time is used as a stopping criterion
Return type:bool
isEnabledMinEpsilonRate(self)
Returns:True if epsilon rate is used as a stopping criterion
Return type:bool
maxIter(self)
Returns:the criterion on number of iterations
Return type:int
maxTime(self)
Returns:the timeout(in seconds)
Return type:double
messageApproximationScheme(self)
Returns:the approximation scheme message
Return type:str
minEpsilonRate(self)
Returns:the value of the minimal epsilon rate
Return type:double
nbrDrawnVar(self)
Returns:the number of variable drawn at each iteration
Return type:int
nbrIterations(self)
Returns:the number of iterations
Return type:int
periodSize(self)
Returns:the number of samples between 2 stopping
Return type:int
Raises:gum.OutOfBounds – If p<1
remainingBurnIn(self)
Returns:the number of remaining burn in
Return type:int
setBurnIn(self, b)
Parameters:b (int) – size of burn in on number of iteration
setDrawnAtRandom(self, _atRandom)
Parameters:_atRandom (bool) – indicates if variables should be drawn at random
setEpsilon(self, eps)
Parameters:eps (double) – the epsilon we want to use
Raises:gum.OutOfBounds – If eps<0
setMaxIter(self, max)
Parameters:max (int) – the maximum number of iteration
Raises:gum.OutOfBounds – If max <= 1
setMaxTime(self, timeout)
Parameters:tiemout (double) – stopping criterion on timeout (in seconds)
Raises:gum.OutOfBounds – If timeout<=0.0
setMinEpsilonRate(self, rate)
Parameters:rate (double) – the minimal epsilon rate
setNbrDrawnVar(self, _nbr)
Parameters:_nbr (int) – the number of variables to be drawn at each iteration
setPeriodSize(self, p)
Parameters:p (int) – number of samples between 2 stopping
Raises:gum.OutOfBounds – If p<1
setVerbosity(self, v)
Parameters:v (bool) – verbosity
startOfPeriod(self)
Returns:True if it is a start of a period
Return type:bool
stateApproximationScheme(self)
Returns:the state of the approximation scheme
Return type:int
stopApproximationScheme(self)

Stop the approximation scheme.

updateApproximationScheme(self, incr=1)

Update the approximation scheme.

verbosity(self)
Returns:True if the verbosity is enabled
Return type:bool