causalcompass.algorithms.PCMCI
- class causalcompass.algorithms.PCMCI(tau_max=3, pc_alpha=0.05, alpha=0.05, cond_ind_test=None, seed=None)[source]
Constraint-based causal discovery method that combines the PC algorithm with Momentary Conditional Independence tests for time series data.
References
https://github.com/jakobrunge/tigramite
- Parameters:
tau_max (int, default 3) – Maximum time lag
pc_alpha (float, default 0.05) – Significance level for PC stable step
alpha (float, default 0.05) – Significance level for MCI test
cond_ind_test (CondIndTest or None, default None) – Conditional independence test object from tigramite.independence_tests or an external test passed as a callable based on tigramite.independence_tests.CondIndTest. If None, ParCorr() will be used by default in run()
Examples
>>> from causalcompass.algorithms import PCMCI >>> model = PCMCI(tau_max=3, pc_alpha=0.05, alpha=0.05) >>> predicted_adj = model.run(X) >>> all_metrics, no_diag_metrics = model.eval(true_adj, predicted_adj)
- __init__(tau_max=3, pc_alpha=0.05, alpha=0.05, cond_ind_test=None, seed=None)[source]
Initialize PCMCI
Methods
__init__([tau_max, pc_alpha, alpha, ...])Initialize PCMCI
eval(true_adj, predicted_adj[, shd_thresholds])Evaluate the predicted adjacency matrix against the ground truth.
run(X)Run PCMCI algorithm.
run_raw(X)Run PCMCI once and return the raw p-value matrix.
run_threshold_sweep(X, thresholds)Run the algorithm once and post-process the raw result for each threshold.