Skip to content

Notebook’s tools for causality

Visualization helpers for causal models in Jupyter notebooks. These functions render pyagrum.CausalModel instances and causal inference results as graphical outputs.

pyagrum.lib.notebook.getCausalModel(cm, size=None)

Section titled “pyagrum.lib.notebook.getCausalModel(cm, size=None)”

return a HTML representing the causal model

  • Parameters:
    • cm (CausalModel) – the causal model
    • size (float | str | None) – the size of the rendered graph
  • Returns: the dot representation
  • Return type: str

pyagrum.lib.notebook.showCausalModel(cm, size=None)

Section titled “pyagrum.lib.notebook.showCausalModel(cm, size=None)”

Shows a pydot svg representation of the causal DAG

  • Parameters:
    • cm (CausalModel) – the causal model
    • size (float | str | None) – the size of the rendered graph
  • Return type: None

pyagrum.lib.notebook.getCausalImpact(model, on, doing, knowing=None, values=None)

Section titled “pyagrum.lib.notebook.getCausalImpact(model, on, doing, knowing=None, values=None)”

return a HTML representing of the three values defining a causal impact : formula, value, explanation

  • Parameters:
    • model (CausalModel) – the causal model
    • on (str | set[str]) – the impacted variable(s)
    • doing (str | set[str]) – the interventions
    • knowing (set[str] | None) – the observations
    • values (dict[str, int] | None) – value for certain variables
  • Return type: HTML

pyagrum.lib.notebook.showCausalImpact(model, on, doing, knowing=None, values=None)

Section titled “pyagrum.lib.notebook.showCausalImpact(model, on, doing, knowing=None, values=None)”

display a HTML representing of the three values defining a causal impact : formula, value, explanation

  • Parameters:
    • model (CausalModel) – the causal model
    • on (str | set[str]) – the impacted variable(s)
    • doing (str | set[str]) – the interventions
    • knowing (set[str] | None) – the observations
    • values (dict[str, int] | None) – value for certain variables
  • Return type: None