alex.ml.lbp package¶
Submodules¶
alex.ml.lbp.node module¶
-
class
alex.ml.lbp.node.
DiscreteFactor
(name, desc, prob_table)[source]¶ Bases:
alex.ml.lbp.node.Factor
This is a base class for discrete factor nodes in the Bayesian Network.
It can works with full conditional table defined by the provided prob_table function.
The variables must be attached in the same order as are the parameters in the prob_table function.
-
class
alex.ml.lbp.node.
DiscreteNode
(name, desc, card, observed=False)[source]¶ Bases:
alex.ml.lbp.node.VariableNode
This is a class for all nodes with discrete/enumerable values.
The probabilities are stored in log format.
-
explain
(full=False, linear_prob=False)[source]¶ This function prints the values and their probabilities for this node.
-
get_most_probable_value
()[source]¶ The function returns the most probable value and its probability in a tuple.
-
get_output_message
(factor)[source]¶ Returns output messages from this node to the given factor.
This is done by subtracting the input log message from the given factor node from the current estimate log probabilities in this node.
-
-
class
alex.ml.lbp.node.
Factor
(name, desc)[source]¶ Bases:
alex.ml.lbp.node.GenericNode
This is a base class for all factor nodes in the Bayesian Network.