26. KCI, Causal Learn (Python)

Command: kci-cl-test
Kind: Independence test

The description below is Tetrad’s own, shown in the interface when you select this method. It is reproduced here so that the method is documented; it has not yet been edited for the manual, and it has no “when to use” guidance of the kind the hand-written pages carry.

An IndependenceWrapper that runs the Kernel-based Conditional Independence (KCI) test implemented in the Python causal-learn library, bridging it into Tetrad’s IndependenceTest framework. How it works Each call to getTest launches (or connects to) a persistent Python process running a bundled server script (python/kci_server.py). CI queries from Java are forwarded to that process via ProcessPythonCiService, and results are returned as standard IndependenceTest responses through PythonKciIndependenceTest. Python environment A Python interpreter that has causal-learn and its dependencies installed must be available on the host machine. The path to that interpreter is supplied via the Params.PYTHON_EXE parameter. There is no default that is likely to be valid on any machine other than the developer’s, so this parameter should always be set explicitly before use. Server script resolution The Python server script is resolved in the following order: If Params.PYTHON_CI_SERVER is set to a non-empty path (and not the sentinel value “Use bundled script”), that path is used directly. Otherwise, the bundled resource python/kci_server.py is extracted to the user’s local cache directory (via PythonResource.extractToUserCache) and that extracted copy is used.