LoopyImportanceSampling.chgEvidence

LoopyImportanceSampling.chgEvidence(*args)

Change the value of an already existing evidence on a node (might be soft or hard).

The sampling inferences (Gibbs, Monte Carlo, Weighted, Importance and their loopy versions) accept only hard evidence.

Parameters:
  • id (int) – a node Id

  • nodeName (str) – a node name

  • val (int | str) – a node value or the label of the node value

  • vals (list of float) – a list of values

Raises:
Return type:

None

Example

import pyagrum as gum

bn = gum.fastBN("A->B<-C", uniform=True)
ie = gum.LoopyImportanceSampling(bn)
ie.addEvidence("A", 0)
ie.chgEvidence("A", 1)
ie.makeInference()
ie.posterior("A").tolist()
# [0.0, 1.0]

Class

LoopyImportanceSampling