citests.tests.kernel_tests¶
Kernel CI tests (survey family): KCI, RCIT, RCoT.
KCIwraps causal-learn’s KCI implementation; available only with the optional[causallearn]extra.RCITandRCoTare randomized kernel CI tests from the R RCIT package (Strobl et al., 2019); require the[r]extra and the R RCIT package installed in your R environment.
Classes¶
Module Contents¶
- class citests.tests.kernel_tests.KCI(data: numpy.ndarray, **kwargs: Any)¶
Bases:
citests.tests.base.CITKTestKernel Conditional Independence (KCI) test, wrapping causal-learn.
Initialise the test and (optionally) load a JSON p-value cache.
- Parameters:
data – Sample matrix in shape
(n, p).cache_path – Optional path to a JSON cache file used to memoise p-values across calls. The cache is keyed by
(data_hash, method_name, parameters_hash)and stamped withformat_versionso v0.1.0 caches can be detected and invalidated by future releases.
- Raises:
TypeError – If
kwargscontains keys outsidecls.accepted_kwargsandcls._protocol_kwargs.
- kci_instance¶
- supported_dtypes¶
- class citests.tests.kernel_tests.RCIT(data: numpy.ndarray, **kwargs: Any)[source]¶
Bases:
_RCITBaseAbstract base class for all conditional independence tests in citests.
Standalone — does not inherit from causal-learn. Subclasses implement
_compute()and use the inherited__call__()for caching.Conforms to the structural
cbcd.CITestProtocol (seen_varsanddetails()), so any citests test instance can be passed straight to a cbcd algorithm:cbcd.pc(data, ci_test=cit).Initialise the test and (optionally) load a JSON p-value cache.
- Parameters:
data – Sample matrix in shape
(n, p).cache_path – Optional path to a JSON cache file used to memoise p-values across calls. The cache is keyed by
(data_hash, method_name, parameters_hash)and stamped withformat_versionso v0.1.0 caches can be detected and invalidated by future releases.
- Raises:
TypeError – If
kwargscontains keys outsidecls.accepted_kwargsandcls._protocol_kwargs.
- method_name = 'rcit'¶
- rcit_func_name = 'RCIT'¶
- class citests.tests.kernel_tests.RCoT(data: numpy.ndarray, **kwargs: Any)[source]¶
Bases:
_RCITBaseAbstract base class for all conditional independence tests in citests.
Standalone — does not inherit from causal-learn. Subclasses implement
_compute()and use the inherited__call__()for caching.Conforms to the structural
cbcd.CITestProtocol (seen_varsanddetails()), so any citests test instance can be passed straight to a cbcd algorithm:cbcd.pc(data, ci_test=cit).Initialise the test and (optionally) load a JSON p-value cache.
- Parameters:
data – Sample matrix in shape
(n, p).cache_path – Optional path to a JSON cache file used to memoise p-values across calls. The cache is keyed by
(data_hash, method_name, parameters_hash)and stamped withformat_versionso v0.1.0 caches can be detected and invalidated by future releases.
- Raises:
TypeError – If
kwargscontains keys outsidecls.accepted_kwargsandcls._protocol_kwargs.
- method_name = 'rcot'¶
- rcit_func_name = 'RCoT'¶