API Reference
This page provides a detailed API reference for the conditional independence tests available in citk.
Simple CI Tests
These are classical statistical methods for conditional independence testing.
- class citk.tests.FisherZ(data: ndarray, **kwargs)
Bases:
CITKTestThis class is a wrapper around the fisherz test from the causal-learn library.
- Parameters:
data (np.ndarray) – The dataset from which to run the test.
- supported_dtypes = {'continuous'}
- class citk.tests.Spearman(data: ndarray, **kwargs)
Bases:
CITKTestThis class is a wrapper around the fisherz test from the causal-learn library on ranked data.
- Parameters:
data (np.ndarray) – The dataset from which to run the test.
- supported_dtypes = {'continuous'}
Regression-Based Tests
These tests use regression-based formulations for conditional independence.
Nearest Neighbor Tests
- class citk.tests.CMIknn(data: ndarray, **kwargs)
Bases:
_TigramiteBase- class_candidates: List[str] = ['tigramite.independence_tests.cmiknn.CMIknn']
- method_name = 'cmiknn'
Kernel Tests
Machine Learning-Based Tests
These tests leverage machine learning models to detect complex, non-linear conditional dependencies.
- class citk.tests.KCI(data, **kwargs)
Bases:
CITKTestWrapper for the Kernel Conditional Independence (KCI) test from the causal-learn library.
- Parameters:
data (np.ndarray) – The dataset from which to run the test.
**kwargs (dict) – Additional keywords for the KCI test. See causal-learn documentation.
- supported_dtypes = {'continuous'}
- class citk.tests.RandomForest(data: ndarray, **kwargs)
Bases:
CITKTestPerforms a conditional independence test using Random Forest feature importance.
- Parameters:
data (np.ndarray) – The dataset from which to run the test.
n_estimators (int, optional) – The number of trees in the forest.
num_permutations (int, optional) – The number of permutations to perform for the permutation test.
random_state (int, optional) – Seed for the random number generator for reproducibility.
- supported_dtypes = {'continuous', 'discrete'}
- class citk.tests.DML(data: ndarray, **kwargs)
Bases:
CITKTestDouble-ML based conditional independence test.
- Parameters:
data (np.ndarray) – The dataset from which to run the test.
model (scikit-learn compatible regressor, optional) – The model used to predict X from Z and Y from Z. Defaults to HistGradientBoostingRegressor.
cv_folds (int, optional) – The number of folds for cross-fitting.
n_perms (int, optional) – Deprecated. Kept for backward compatibility.
- supported_dtypes = {'continuous'}
- class citk.tests.CRIT(data: ndarray, **kwargs)
Bases:
CITKTestConformalized Residual Independence Test (CRIT).
- Parameters:
data (np.ndarray) – The dataset from which to run the test.
alpha (float, optional) – The significance level for the conformal prediction intervals.
cv_folds (int, optional) – The number of folds for cross-fitting.
n_perms (int, optional) – Deprecated. Kept for backward compatibility.
- supported_dtypes = {'continuous'}
- class citk.tests.EDML(data: ndarray, **kwargs)
Bases:
CITKTestE-Value Double-ML based conditional independence test.
- Parameters:
data (np.ndarray) – The dataset from which to run the test.
model (scikit-learn compatible regressor, optional) – The model used to predict X from Z and Y from Z. Defaults to HistGradientBoostingRegressor.
cv_folds (int, optional) – The number of folds for cross-fitting the residual models.
betting_folds (int, optional) – The number of folds for the e-value betting mechanism.
- supported_dtypes = {'continuous'}
Adapter Tests
- class citk.tests.DiscChiSq(data: ndarray, **kwargs)
Bases:
CITKTest- supported_dtypes = {'continuous', 'discrete'}
- class citk.tests.DiscGSq(data: ndarray, **kwargs)
Bases:
CITKTest- supported_dtypes = {'continuous', 'discrete'}
- class citk.tests.DummyFisherZ(data: ndarray, **kwargs)
Bases:
CITKTest- supported_dtypes = {'continuous', 'discrete'}