lib.notebook.showCausalImpactGraph

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

show a causal impact drawn on its causal model: the histogram of P(on | do(doing), knowing) on the impacted variable, the values of the interventions and of the observations, and the colors of the variables used by the formula of the do-calculus (see pyagrum.lib.causal2graph.causalImpact2dot).

Parameters:
  • model (pyagrum.CausalModel) – the causal model

  • on (str | set[str]) – the impacted variable (only one)

  • doing (str | set[str]) – the variables under intervention

  • knowing (str | set[str], optional) – the observed variables

  • values (dict[str, str | int]) – the value (label, or index of the label) of each variable of doing and knowing, and of no other variable

  • size (float | str, optional) – the size of the rendered graph

Return type:

None

Example

import pyagrum as gum
import pyagrum.lib.notebook as gnb

cm = gum.CausalModel(gum.fastBN("W->X->Y;W->Y;Z->Y"))
gnb.showCausalImpactGraph(cm, on="Y", doing="X", knowing="Z", values={"X": "1", "Z": "0"})  # W used by the formula