Skip to content

Inference for Influence Diagram

an inference in an influence diagram

class pyagrum.ShaferShenoyLIMIDInference(infDiag)

Section titled “class pyagrum.ShaferShenoyLIMIDInference(infDiag)”

This inference considers the provided model as a LIMID rather than an influence diagram. It is an optimized implementation of the LIMID resolution algorithm. However an inference on a classical influence diagram can be performed by adding a assumption of the existence of the sequence of decision nodes to be solved, which also implies that the decision choices can have an impact on the rest of the sequence (Non Forgetting Assumption, cf. pyagrum.ShaferShenoyLIMIDInference.addNoForgettingAssumption).

Returns maximum expected utility obtained from inference.

Adds a new evidence on a node (might be soft or hard).

  • Return type: None

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

  • Parameters:
    • id (int) – a node Id
    • nodeName (int) – a node name
    • val (intstr) – a node value or the label of the node value
    • vals (List [**float ]) – a list of values
  • Raises:
  • Return type: None
  • Return type: None

Remove all evidence.

  • Return type: None

Remove the evidence, if any, corresponding to the node Id or name.

  • Parameters:
    • id (int) – a node Id
    • nodeName (int) – a node name
  • Raises: pyagrum.IndexError – If the node does not belong to the Bayesian network
  • Return type: None
  • Returns: the set of nodes with hard evidence
  • Return type: set
  • Parameters:
    • id (int) – a node Id
    • nodeName (str) – a node name
  • Returns: True if some node(s) (or the one in parameters) have received evidence
  • Return type: bool
  • Raises: pyagrum.IndexError – If the node does not belong to the Bayesian network
  • Parameters:
    • id (int) – a node Id
    • nodeName (str) – a node name
  • Returns: True if node has received a hard evidence
  • Return type: bool
  • Raises: pyagrum.IndexError – If the node does not belong to the Bayesian network
  • Return type: bool
  • Parameters:
    • id (int) – a node Id
    • nodeName (str) – a node name
  • Returns: True if node has received a soft evidence
  • Return type: bool
  • Raises: pyagrum.IndexError – If the node does not belong to the Bayesian network

Returns a constant reference over the InfluenceDiagram on which this class work.

check wether the influence diagram is solvable or not

  • Returns: True if the influence diagram is solvable
  • Return type: bool

Perform the heavy computations needed to compute the optimal decisions.

  • Return type: None
  • Parameters:
    • id (int) – a node Id
    • nodeName (str) – a node name
  • Returns: a dictionary with the mean and variance of the node (after the inference)
  • Return type: dict[str, float]
  • Returns: the number of evidence entered into the Bayesian network
  • Return type: int
  • Returns: the number of hard evidence entered into the Bayesian network
  • Return type: int
  • Returns: the number of soft evidence entered into the Bayesian network
  • Return type: int

Returns best choice for decision variable given in parameter ( based upon MEU criteria )

  • Parameters: decisionId (int ,**str) – the id or name of the decision variable
  • Raises: pyagrum.OperationNotAllowed – If no inference have yet been made
  • Return type: Tensor

pyagrum.InvalidNode : If node given in parmaeter is not a decision node

Returns the posterior of a chance or a decision node (after optimisation).

  • Parameters:
    • var (int) – the node Id of the node for which we need a posterior probability
    • nodeName (str) – the node name of the node for which we need a posterior probability
  • Returns: a const ref to the posterior probability of the node
  • Return type: pyagrum.Tensor

Returns the posterior utiliyt of a utility node (after optimisation) depending on decision nodes, if any.

  • Parameters:
    • var (int) – the node Id of the node for which we need a posterior probability
    • nodeName (str) – the node name of the node for which we need a posterior probability
  • Returns: a const ref to the posterior utility of the utility node
  • Return type: pyagrum.Tensor

Returns the DAG build to solve the influence diagram.

  • Returns: a copy of the reduced graph
  • Return type: pyagrum.DAG

Returns the (reduced) LIMID build to solve the influence diagram.

Erase all the evidences and apply addEvidence(key,value) for every pairs in evidces.

  • Return type: object

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