inferlo.generic.libdai_bp.BP
- class inferlo.generic.libdai_bp.BP[source]
Belief propagation algorithm, equivalent to dai::BP.
This class is ported from libDAI’s dai::BP class. It runs belief propagation algorithm for graphical model with discrete variables with arbitrary factor graph.
At the moment MAXPROD algorithm (for finding MAP state) is not supported.
Use BP.infer() to perform inference.
- __init__(model: GraphModel, props: Dict[str, str])[source]
Methods
__init__
(model, props)Find max residual.
infer
(model[, options])Runs inference BP algorithm for given model.
init
()Initializes messages awith default values.
log_z
()Calculates logarithm of the partition function.
Calculates marginal probabilities.
run
()Runs BP algorithm.