PC doesn't recover the ground truth even when the results of d-separation are used as CI test results
Yangliu-SY opened this issue · comments
I noticed that PC can be called with using d-separation as CI test in the package.
I have the following codes where I give the DAG of the ground truth. I was expecting that PC recovers the same DAG.
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
from causallearn.search.ConstraintBased.PC import pc
data = np.random.random(size=(1000, 5)) # This is just a placeholder since I'm using d-separation as CI tests and no data is actually needed
G_synthetic = nx.DiGraph()
G_synthetic.add_nodes_from([0, 1, 2, 3, 4])
G_synthetic.add_edges_from([(0, 2), (0, 3), (0, 4), (1, 0), (1, 3), (1, 4)])
nx.draw(G_synthetic, with_labels=True)
plt.show()
plt.close()
cg = pc(data, indep_test="d_separation", true_dag=G_synthetic)
cg.draw_pydot_graph()
PC returns an undirected graph.
Is it valid to use d-separation as CI tests? Can you replicate this behavior on your end?
Is this expected behavior of PC?
Hi, it is valid to use d-separations as CI tests (thanks @zhi-yi-huang for confirmation). But it seems that your ground truth does not contain any v-structures so that PC will naturally return an undirected graph. Please let us know if we understand it incorrectly.
Thanks for your answer. Indeed our ground truth has no v-structure.