Skip to content

Add HSCIC-CPT conditional independence test - #270

Open
felix-laumann wants to merge 1 commit into
py-why:mainfrom
felix-laumann:feature/hscic-cpt
Open

Add HSCIC-CPT conditional independence test#270
felix-laumann wants to merge 1 commit into
py-why:mainfrom
felix-laumann:feature/hscic-cpt

Conversation

@felix-laumann

@felix-laumann felix-laumann commented Jul 28, 2026

Copy link
Copy Markdown

Summary

This pull request adds HSCIC-CPT as a conditional independence test and exposes it through causal-learn's existing CIT and PC interfaces.

  • implements the Hilbert-Schmidt conditional independence criterion (HSCIC)
  • calibrates HSCIC with the exchangeable conditional permutation test (CPT) sampler
  • uses a held-out training/evaluation split and selects the HSCIC ridge on training data only
  • supports the built-in linear-Gaussian conditional-density model or a user-supplied conditional-density callback
  • evaluates conditional queries in both directions and combines the directional p-values with a Bonferroni-adjusted minimum, avoiding dependence on arbitrary column ordering
  • adds API documentation, references, and dedicated tests

Implementation fidelity

The CPT transition uses likelihood-matrix orientation, identity start, shared Markov-chain centre, disjoint-pair proposals, swap log-odds, and numerical truncation. Kernel bandwidth selection follows lower-median convention, including duplicated observations.

The lower-level HSCICCPT class remains directional because CPT resamples one variable conditionally. The public causal-discovery wrapper makes the test symmetric by testing both directions.

Validation

  • python -m unittest tests.TestCIT_HSCICCPT — 13 tests passed
  • python -m pytest tests/TestCIT_HSCICCPT.py -q — 13 tests passed
  • PC integration smoke test passed
  • Sphinx HTML documentation build completed successfully
  • compileall, codespell, and git diff --check passed

References

Signed-off-by: Felix Laumann <22920497+felix-laumann@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant