Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PC doesn't recover the ground truth even when the results of d-separation are used as CI test results #133

Closed
Yangliu-SY opened this issue Sep 7, 2023 · 2 comments

Comments

@Yangliu-SY
Copy link

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?

@kunwuz
Copy link
Collaborator

kunwuz commented Oct 13, 2023

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.

@Yangliu-SY
Copy link
Author

Thanks for your answer. Indeed our ground truth has no v-structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants