WeightedSampling.currentPosterior
- WeightedSampling.currentPosterior(*args)
Returns the current estimation of the posterior of a node (for instance during the inference, in a listener). It is the evidence for an observed node. Unlike
posterior, this method does not start the inference and accepts a node which is not a target.- Parameters:
id (
int) – the node Id of the node for which we need a posterior probabilityname (
str) – the node name of the node for which we need a posterior probability
- Returns:
a const ref to the current posterior probability of the node
- Return type:
- Raises:
pyagrum.NotFound – If the node does not belong to the Bayesian network, or if it is not observed and no estimation exists yet (inference not started)
Example
import pyagrum as gum
bn = gum.fastBN("A->B<-C", uniform=True)
ie = gum.WeightedSampling(bn)
ie.addEvidence("A", 1)
ie.makeInference()
round(ie.currentPosterior("B").sum(), 4)
# 1.0
Class
Overridden in