Causal Model

class pyAgrum.causal.CausalModel(bn: 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.

Parameters:
  • 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
causalBN() → pyAgrum.BayesNet
Returns:the causal Bayesian network
Warning:do not infer any computations in this model. It is strictly a structural model
children(x: Union[int, str]) → Set[int]
Parameters:x – the node
Returns:
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
observationalBN() → pyAgrum.BayesNet
Returns:the observational Bayesian network
parents(x: Union[int, str]) → Set[int]

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

Parameters:x – the node
Returns: