A pure-Python reference implementation of CCTM v0.1, the sixth member of the Tsetlin Machine family alongside TM, GTM, HTM, HGTM, and THGTM.
CCTM bakes causality into training via three new primitives:
-
Counterfactual data augmentation: every sample
$(x, y)$ is trained with an aligned CF partner$(x', y')$ from an external oracle. - Type-III contrastive feedback: running per-clause causal score and per-feature treatment effect, both first-class outputs.
- Structural counterfactual recourse with SAT receipts: minimal feasibility-respecting flip sets derived from clause structure, packaged as DIMACS + HMAC certificates an auditor can re-verify in ~0.1 ms.
The accompanying paper is at paper/cctm.pdf.
pip install -e .
pytest -q tests/ # 14 unit tests, ~7 s
make reproduce # all 3 experiments, ~60 s on CPU
make paper # build paper/cctm.pdf| Path | What it is |
|---|---|
cctm/ta.py |
Canonical Tsetlin Automaton bank (no trace; THGTM's ETTA is a separate variant). |
cctm/tm.py |
Binary Tsetlin Machine wrapper used by every experiment. |
cctm/causal.py |
CCTM core: Type-III feedback, causal score, treatment effect, causal influence. |
cctm/recourse.py |
Exact and greedy structural recourse with feasibility constraints. |
cctm/receipts.py |
Signed DIMACS+HMAC counterfactual receipts and offline verification. |
cctm/data.py |
Bundled synthetic SCM and loan-denial datasets. |
tests/ |
14 unit tests, all green. |
experiments/synthetic_scm.py |
ATE recovery vs vanilla TM. |
experiments/loan_recourse.py |
Recourse quality + receipt verification. |
experiments/fairness_audit.py |
Bias recovery + biased-clause audit. |
scripts/make_figures.py |
Builds every figure from results/*.json. |
paper/cctm.tex, references.bib |
Paper source. |
paper/figures/*.pdf |
Figures from real experiment data. |
results/*.json |
Raw per-seed records. |
| Experiment | Vanilla TM | CCTM |
|---|---|---|
| Synthetic SCM ATE Pearson (pred-flip) | ||
| Loan recourse success |
|
|
| Loan recourse latency (ms) |
|
|
| Fairness: accuracy vs clean truth | ||
| Fairness: demographic parity | ||
| Fairness + clause audit DP | n/a | |
| CF receipts verified (60 attempts) | n/a |
See paper/cctm.pdf for the full discussion, limitations and the
regulatory framing (EU AI Act Article 86 effective 2 Aug 2026, GDPR
Article 22, US ECOA).
- CCTM conditions on an external CF oracle; it does NOT learn a causal DAG. Full do-calculus is future work.
- Single-feature interventions only in v0.1.
- The loan and SCM experiments are synthetic (bundled). Real-world evaluation (Adult-Income, COMPAS) is future work.
- On clean loan data CCTM and vanilla TM tie on recourse quality. The CCTM advantage shows up under biased data (fairness audit experiment).
- No federated / differentially-private aggregation story.
MIT.
@misc{debes2026cctm,
title = {CCTM: A Counterfactual Causal Tsetlin Machine for
Regulatorily-Compliant Individual Decision Explanations},
author = {Debes, Anwar},
year = {2026},
note = {Reference implementation, v0.1, May 2026}
}