Slide 18
Slide 18 text
複雑な DAG から交絡因子を発見する (2/2)
!pip install dowhy
!pip install pydot
!apt-get install -y graphviz
!pip install networkx
import dowhy
from dowhy import CausalModel
import networkx as nx
import pandas as pd
g = nx.DiGraph()
g.add_edges_from([
('X1', 'X3'), ('X1', 'X4'),
('X2', 'X4'), ('X2', 'X5'),
('X3', 'X'), ('X4', 'X'), ('X5', 'X'),
('X', 'X6'),
('X1', 'X6'), ('X2', 'X6'),
('X', 'Y'), ('X3', 'Y'), ('X4', 'Y'), ('X5', 'Y'), ('X6', 'Y')
])
all_vars = sorted(list(g.nodes()))
dummy_data = pd.DataFrame(columns=all_vars)