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.2k stars 197 forks source link

FCI algorithm with KCI testing method #73

Closed Peng0618 closed 1 year ago

Peng0618 commented 2 years ago

Hello,

I am testing the fci algrithm and its defaul independence testing method is 'fisherz'. I tried to use the 'kci' testing method. But it shows:

TypeError: '(slice(None, None, None), [0])' is an invalid key.

So, is there any example about the fci algorithm with kci method? Thank you.

MarkDana commented 2 years ago

Thanks for reaching out. Could you please tell us your causal-learn version and the minimum code snippet that reproduces your issue?

Since G, edges = fci(data, 'kci', 0.05, verbose=False) should work.

Peng0618 commented 2 years ago

Hi, the causal-learn version is 0.1.2.8. Thanks for your sample. I have solved it.

BTW, the kci testing is much slower than fisherz, especially when the number of variables is large... But it is still a good choice.

MarkDana commented 2 years ago

Yep. kci is basically in O(n^3) time complexity, with n being the sample size.

The good thing is that kci is nonparametric, while fisherz only works for joint Gaussian.