Causal Model

class pyAgrum.causal.CausalModel(bn: pyAgrum.pyAgrum.BayesNet, latentVarsDescriptor: Optional[List[Tuple[str, Tuple[str, str]]]] = None, keepArcs: bool = False)

From an observational BNs and the description of latent variables, this class represent a complet causal model obtained by adding the latent variables specified in latentVarsDescriptor to the Bayesian network bn.

  • bn – a observational bayesian network
  • latentVarsDescriptor – list of couples (<latent variable name>, <list of affected variables’ ids>).
  • keepArcs – By default, the arcs between variables affected by a common latent variable will be removed but this can be avoided by setting keepArcs to True
biArcs() → List[Tuple[str, Tuple[str, str]]]
Returns:list of descriptor of latent variables
bn() → pyAgrum.pyAgrum.BayesNet
Returns:the observational Bayesian network
children(x: int) → Set[int]
Parameters:x – the node
idFromName(name: str) → int
Parameters:name – the name of the variable
Returns:the id of the variable
latentVariablesIds() → Set[int]
Returns:the set of ids of latent variables in the causal model
names() → Dict[int, str]
Returns:the map NodeId,Name
parents(x: int) → Set[int]

From a NodeId, returns its parent (as a set of NodeId)

Parameters:x – the node