VariableElimination.updateEvidence

VariableElimination.updateEvidence(evidces)

Apply chgEvidence(key,value) for every pairs in evidces (or addEvidence).

Parameters:

evidces (dict[str,Union[int,str,list[float]]] or list[pyagrum.Tensor]) – a dict of “name:evidence” where name is a string (the name of the variable) and evidence is an integer (an index) or a string (a label) or a list of float (a likelihood).

Raises:
Return type:

None

Example

import pyagrum as gum

bn = gum.fastBN("A->B->C")
ie = gum.VariableElimination(bn)
ie.setEvidence({"A": 0, "B": 1})
ie.updateEvidence({"A": 1, "C": [0.2, 0.9]})  # B is kept, A is changed, C is added
ie.nbrEvidence()
# 3
sorted(ie.softEvidenceNodes())
# [2]

Class

VariableElimination