causal-learn icon indicating copy to clipboard operation
causal-learn copied to clipboard

Custom CI test

Open mchikina opened this issue 9 months ago • 5 comments

How can I implement a custom CI test to use with PC. It seems that only built in tests are supported now.

mchikina avatar Mar 14 '25 18:03 mchikina

#202 this is a good example written by @OliverSchacht

kunwuz avatar Mar 14 '25 18:03 kunwuz

This is a PR. I wasn't planning on modifying the package code but just wanted to test some things out. Is there no way to do that in the python version.

mchikina avatar Mar 14 '25 18:03 mchikina

Yeah I understand that. In order to use a custom CI test, you need to wrap it as a class in cit.py, and then directly call it by changing the parameter 'indep_test' in PC. That PR could be helpful for doing that.

And you are right, there is currently no way to do it without any modification of the code.

kunwuz avatar Mar 14 '25 18:03 kunwuz

Thanks. Native support for custom CI tests via a function call would be a great feature.

mchikina avatar Mar 14 '25 18:03 mchikina

Thanks for the great suggestion. The CI test classes in cit.py just take X, Y and condition set as input and output the p-value, for example: https://github.com/py-why/causal-learn/blob/e4b5f120256b86b9b9656dfbf1ba9e948b1d56ec/causallearn/utils/cit.py#L148

So, including a native support for that won't be very difficult. We will let you know when this is available. If you would like to use custom tests in the near future, the way mentioned above shouldn't be too complicated either, and I would always be happy to help if you have any questions.

kunwuz avatar Mar 14 '25 18:03 kunwuz