ShaferShenoyMRFInference.hasEvidence

ShaferShenoyMRFInference.hasEvidence(*args)

Indicates whether a node has received evidence or, without argument, whether at least one node has.

Parameters:
  • id (int, optional) – a node Id

  • nodeName (str, optional) – a node name

Returns:

True if the node (or at least one node, without argument) has received evidence

Return type:

bool

Raises:

pyagrum.NotFound – If nodeName is not the name of a node (an unknown node Id is not an error: the result is False)

Example

import pyagrum as gum

mrf = gum.fastMRF("A--B;B--C;C--D")
ie = gum.ShaferShenoyMRFInference(mrf)
ie.hasEvidence("A")
# False
ie.setEvidence({"A": 1})
ie.hasEvidence("A")
# True
ie.hasEvidence("C")
# False

Class

ShaferShenoyMRFInference