py-why / causal-learn

Causal Discovery in Python. It also includes (conditional) independence tests and score functions.
https://causal-learn.readthedocs.io/en/latest/
MIT License
1.13k stars 186 forks source link

A potential Bug in GES.py #164

Closed tingyushi closed 8 months ago

tingyushi commented 8 months ago

Hello,

I was looking at ges function implemented in GES.py.

In line 141 and line 142, the code was trying to find the adjacent nodes of $X_i$.

Ti = np.union1d(np.where(G.graph[:, i] != Endpoint.NULL.value)[0],
                           np.where(G.graph[i, 0] != Endpoint.NULL.value)[0])  # adjacent to Xi

For the second argument of np.union1d, should we change to the following?

Ti = np.union1d(np.where(G.graph[:, i] != Endpoint.NULL.value)[0],
                           np.where(G.graph[i, :] != Endpoint.NULL.value)[0])  # adjacent to Xi

Thanks!!!

kunwuz commented 8 months ago

Thanks! This has been fixed by @zhi-yi-huang in #165