ImportanceSampling.hasEvidence

ImportanceSampling.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

bn = gum.fastBN("A->B<-C", uniform=True)
ie = gum.ImportanceSampling(bn)
ie.addEvidence("A", 1)
ie.hasEvidence("A"), ie.hasEvidence("B")
# (True, False)

Class

ImportanceSampling

Overridden in

LoopyImportanceSampling.hasEvidence