Skip to content

Explanation and analysis

Analysing inference with JunctionTreeGenerator

This tools aimed to provide some different views on the Bayesian network in order to explore its qualitative and/or quantitave behaviours.

JunctionTreeGenerator is use to generate junction tree or binary junction tree from Bayesian networks.

JunctionTreeGenerator() -> JunctionTreeGenerator : default constructor

Computes the binary joint tree for its parameters. If the first parameter is a graph, the heurisitcs assume that all the node have the same domain size (2). If given, the heuristic takes into account the partial order for its elimination order.

Computes the elimination for its parameters. If the first parameter is a graph, the heurisitcs assume that all the node have the same domain size (2). If given, the heuristic takes into account the partial order for its elimination order.

Computes the junction tree for its parameters. If the first parameter is a graph, the heurisitcs assume that all the node have the same domain size (2). If given, the heuristic takes into account the partial order for its elimination order.

Class building the essential graph from a BN.

Essential graph is a mixed graph (Chain Graph) that represents the class of markov equivalent Bayesian networks (with the same independency model).

EssentialGraph(m) -> EssentialGraph : Parameters: : - m (pyagrum.DAGmodel) – a DAGmodel

adjacency matrix from a graph/graphical models

Compute the adjacency matrix of a pyAgrum’s graph or graphical models (more generally an object that has nodes, children/parents or neighbours methods)

  • Returns: adjacency matrix (as numpy.ndarray) with nodeId as key.
  • Return type: numpy.ndarray
  • Returns: The lisf of arcs in the EssentialGraph
  • Return type: list
  • Parameters: id (int) – the id of the parent
  • Returns: the set of all the children
  • Return type: Set

connected components from a graph/graphical models

Compute the connected components of a pyAgrum’s graph or graphical models (more generally an object that has nodes, children/parents or neighbours methods)

The firstly visited node for each component is called a ‘root’ and is used as a key for the component. This root has been arbitrarily chosen during the algorithm.

  • Returns: dict of connected components (as set of nodeIds (int)) with a nodeId (root) of each component as key.
  • Return type: dict(int,Set[int])
  • Returns: the list of the edges
  • Return type: List
  • Parameters: name (str) – the name of the variable in the model
  • Returns: the nodeId from the name of the variable in the model
  • Return type: int
  • Parameters: node (int) – the nodeId of the variable in the model
  • Returns: the name of the variable in the model from the nodeId
  • Return type: str
  • Parameters: id (int) – the id of the checked node
  • Returns: The set of edges adjacent to the given node
  • Return type: Set
  • Return type: object
  • Parameters: id (int) – The id of the child node
  • Returns: the set of the parents ids.
  • Return type: Set
  • Returns: the PDAG (Partially Directed Graph)
  • Return type: pyagrum.PDAG
  • Returns: the number of nodes in the graph
  • Return type: int
  • Returns: the number of arcs in the graph
  • Return type: int
  • Returns: the number of edges in the graph
  • Return type: int
  • Returns: the number of nodes in the graph
  • Return type: int
  • Returns: a friendly display of the graph in DOT format
  • Return type: str

Class building the Markov blanket of a node in a graph.

MarkovBlanket(m,n) -> MarkovBlanket : Parameters: : - m (pyagrum.DAGmodel) – a DAGmodel - n (int) – a node id

MarkovBlanket(m,name) -> MarkovBlanket : Parameters: : - m (pyagrum.DAGmodel) – a DAGmodel - name (str) – a node name

adjacency matrix from a graph/graphical models

Compute the adjacency matrix of a pyAgrum’s graph or graphical models (more generally an object that has nodes, children/parents or neighbours methods)

  • Returns: adjacency matrix (as numpy.ndarray) with nodeId as key.
  • Return type: numpy.ndarray
  • Returns: the list of the arcs
  • Return type: List
  • Parameters: id (int) – the id of the parent
  • Returns: the set of all the children
  • Return type: Set

connected components from a graph/graphical models

Compute the connected components of a pyAgrum’s graph or graphical models (more generally an object that has nodes, children/parents or neighbours methods)

The firstly visited node for each component is called a ‘root’ and is used as a key for the component. This root has been arbitrarily chosen during the algorithm.

  • Returns: dict of connected components (as set of nodeIds (int)) with a nodeId (root) of each component as key.
  • Return type: dict(int,Set[int])
  • Parameters: pyagrum.DAGmodel – a direct acyclic model
  • Returns: True if all the named node are the same and all the named arcs are the same
  • Return type: bool
  • Returns: the set of ids
  • Return type: set
  • Parameters: id (int) – The id of the child node
  • Returns: the set of the parents ids.
  • Return type: Set
  • Returns: the number of nodes in the graph
  • Return type: int
  • Returns: the number of arcs in the graph
  • Return type: int
  • Returns: the number of nodes in the graph
  • Return type: int
  • Returns: a friendly display of the graph in DOT format
  • Return type: str