citk.tests package
This package contains the implementations of various conditional independence tests.
Partial Correlation Tests
Contingency Table Tests
Regression-Based Tests
Nearest Neighbor Tests
- class citk.tests.nearest_neighbor_tests.CMIknn(data: ndarray, **kwargs)
Bases:
_TigramiteBase- class_candidates: List[str] = ['tigramite.independence_tests.cmiknn.CMIknn']
- method_name = 'cmiknn'
Kernel Tests
- class citk.tests.kernel_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'}
ML-Based Tests
- class citk.tests.ml_based_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.ml_based_tests.GCMLinear(data: ndarray, **kwargs)
Bases:
CITKTest- supported_dtypes = {'continuous'}
- class citk.tests.ml_based_tests.GCMRF(data: ndarray, **kwargs)
Bases:
CITKTest- supported_dtypes = {'continuous'}
- class citk.tests.ml_based_tests.WGCMRF(data: ndarray, **kwargs)
Bases:
CITKTest- supported_dtypes = {'continuous'}
- class citk.tests.ml_based_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.ml_based_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.ml_based_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.adapter_tests.DiscChiSq(data: ndarray, **kwargs)
Bases:
CITKTest- supported_dtypes = {'continuous', 'discrete'}
- class citk.tests.adapter_tests.DiscGSq(data: ndarray, **kwargs)
Bases:
CITKTest- supported_dtypes = {'continuous', 'discrete'}
- class citk.tests.adapter_tests.DummyFisherZ(data: ndarray, **kwargs)
Bases:
CITKTest- supported_dtypes = {'continuous', 'discrete'}