citk.tests.base module

class citk.tests.base.CITKTest(data, **kwargs)

Bases: CIT_Base

Abstract base class for all conditional independence tests in the citk package. It standardizes the interface to be compatible with causal-learn and implements a robust file-based caching mechanism.

__call__(X, Y, condition_set=None, **kwargs)

Executes the conditional independence test. Subclasses must implement this method.

Parameters:
  • X (int) – The index of the first variable.

  • Y (int) – The index of the second variable.

  • condition_set (list[int], optional) – A list of indices for the conditioning set. Can be empty.

Returns:

p_value – The p-value of the test.

Return type:

float

save_cache()

Explicitly saves the p-value cache to the file path provided during initialization. This is more reliable than relying on the garbage collector with __del__.