LoopyMonteCarloSampling.makeInference

LoopyMonteCarloSampling.makeInference()

Perform the heavy computations needed to compute the targets’ posteriors

In a Junction tree propagation scheme, for instance, the heavy computations are those of the messages sent in the JT. This is precisely what makeInference should compute. Later, the computations of the posteriors can be done ‘lightly’ by multiplying and projecting those messages.

Return type:

None

Example

import pyagrum as gum

bn = gum.fastBN("A->B<-C", uniform=True)
ie = gum.LoopyMonteCarloSampling(bn)
ie.setEvidence({"A": 1})
ie.setEpsilon(1e-10)
ie.setMaxIter(1000)
ie.makeInference()
ie.messageApproximationScheme()
# 'stopped with max iteration=1000'
ie.posterior("A").tolist()
# [0.0, 1.0]

Class

LoopyMonteCarloSampling