COREX-Causal: Causal Origin Resolution and Empirical eXamination โ Framework for Robust Causal Discrimination
Project description
COREX
Causal Origin Resolution and Empirical eXamination
An Autonomous Multi-Stage Framework for Robust Causal Discrimination in Data-Driven AI Systems
๐ Overview
COREX is a deterministic, graph-free, model-agnostic computational framework that treats causality as an empirically testable robustness property rather than an assumed structural characteristic.
"Causality is not assumed, inferred, or interpreted โ it is survived or rejected under systematic perturbation tests."
Contemporary machine learning systems routinely exploit shortcut correlations embedded in training distributions โ associations that collapse the moment data distribution shifts, feature encodings change, or interventions are applied. COREX provides a principled four-axis audit pipeline to classify any observed X โ Y relationship as:
| Label | COREX Score | Meaning |
|---|---|---|
| ๐ข CAUSAL | โฅ 0.80 | Survives all four evaluation axes |
| ๐ก SPURIOUS | 0.50 โ 0.79 | Breaks under domain shift or intervention |
| ๐ด REPRESENTATION ARTIFACT | < 0.50 | Exists only as a function of encoding choice |
๐๏ธ Table of Contents
- Overview
- Key Features
- Project Structure
- Quick Start
- COREX Pipeline
- Scoring Function
- Platforms & Mirrors
- Clone & Download
- Citation
- License
- Author
โจ Key Features
- Four-module evaluation pipeline โ Statistical Stability, Representation Invariance, Domain Robustness, Intervention Consistency
- No prior causal graph required โ purely empirical robustness testing
- Model-agnostic โ works as a meta-evaluation layer atop any learned relationship
- Calibrated causal scoring โ weighted fusion with interpretable decision thresholds
- Optional learnable inference layer โ adaptive calibration for high-dimensional settings
- Validated on biomedical signals โ vagus nerve electrophysiology, LPS/SIRS/CAR-T models
- Full open-source distribution โ available across 11 platforms
๐ Project Structure
COREX/
โ
โโโ corex/ # Core Python package
โ โโโ __init__.py # Package entry point & public API
โ โโโ pipeline.py # Main COREX evaluation pipeline
โ โโโ score.py # Causal scoring function & decision logic
โ โ
โ โโโ modules/ # Evaluation modules
โ โ โโโ __init__.py
โ โ โโโ statistical.py # Module 1: Statistical Stability (S)
โ โ โโโ representation.py # Module 2: Representation Invariance (R)
โ โ โโโ domain.py # Module 3: Domain Robustness (D)
โ โ โโโ intervention.py # Module 4: Intervention Consistency (I)
โ โ
โ โโโ learnable/ # Optional learnable inference layer
โ โ โโโ __init__.py
โ โ โโโ meta_scorer.py # Adaptive MLP weight estimator
โ โ โโโ weights/ # Pre-trained weight checkpoints
โ โ โโโ default.pt
โ โ
โ โโโ utils/ # Shared utilities
โ โโโ __init__.py
โ โโโ transforms.py # Feature transformation library (ฯ family)
โ โโโ environments.py # Environment construction & partitioning
โ โโโ counterfactual.py # Intervention simulation engine
โ โโโ metrics.py # KL divergence, KS tests, CV, etc.
โ
โโโ benchmarks/ # Synthetic ground-truth benchmarks
โ โโโ generators/
โ โ โโโ causal_chain.py # Class C: true causal chains XโYโZ
โ โ โโโ spurious_confound.py # Class S: latent confounder HโX, HโY
โ โ โโโ artifact_encoding.py # Class A: encoding-dependent associations
โ โโโ run_benchmarks.py # Full benchmark evaluation script
โ โโโ results/ # Pre-computed benchmark outputs
โ โโโ synthetic_1500.json
โ
โโโ validation/ # Real-world biomedical validation
โ โโโ vagus_nerve/
โ โ โโโ preprocess.py # Electrophysiology signal preprocessing
โ โ โโโ feature_extraction.py # Wavelet, PCA, CNN embedding extraction
โ โ โโโ evaluate.py # COREX evaluation on vagalโcytokine data
โ โโโ results/
โ โโโ biomedical_validation.json
โ
โโโ examples/ # Usage examples & tutorials
โ โโโ quickstart.py # Minimal working example
โ โโโ synthetic_demo.ipynb # Jupyter notebook: synthetic datasets
โ โโโ biomedical_demo.ipynb # Jupyter notebook: biomedical signals
โ โโโ custom_weights.py # Custom weight configuration example
โ
โโโ tests/ # Unit and integration tests
โ โโโ test_statistical.py
โ โโโ test_representation.py
โ โโโ test_domain.py
โ โโโ test_intervention.py
โ โโโ test_pipeline.py
โ โโโ test_scoring.py
โ
โโโ docs/ # Documentation source
โ โโโ architecture.md # Pipeline architecture reference
โ โโโ modules.md # Per-module API documentation
โ โโโ scoring.md # Scoring function & threshold calibration
โ โโโ api_reference.md # Full Python API reference
โ
โโโ paper/ # Research paper artifacts
โ โโโ COREX_Research_Paper.pdf # Published paper (PDF)
โ โโโ COREX_Research_Paper.docx # Editable Word version
โ โโโ figures/ # Paper figures & diagrams
โ โโโ pipeline_diagram.svg
โ
โโโ .gitlab-ci.yml # GitLab CI/CD pipeline
โโโ .github/ # GitHub Actions workflows
โ โโโ workflows/
โ โโโ tests.yml
โ โโโ publish.yml
โโโ pyproject.toml # Build system configuration
โโโ setup.cfg # Package metadata
โโโ requirements.txt # Runtime dependencies
โโโ requirements-dev.txt # Development dependencies
โโโ CHANGELOG.md # Version history
โโโ CONTRIBUTING.md # Contribution guidelines
โโโ CODE_OF_CONDUCT.md
โโโ AUTHORS.md # Author and contributor registry
โโโ LICENSE # MIT License
โโโ README.md # This file
๐ Quick Start
Installation
# Install from PyPI
pip install corex-causal-causal-causal-causal
# Install from source
git clone https://github.com/gitdeeper12/COREX.git
cd COREX
pip install -e .
Minimal Example
from corex import CausalEvaluator
# Initialize the evaluator
evaluator = CausalEvaluator()
# Load your data
# X: feature array of shape (n_samples, n_features)
# Y: target array of shape (n_samples,)
result = evaluator.evaluate(X, Y)
print(result.label) # "CAUSAL" | "SPURIOUS" | "REPRESENTATION_ARTIFACT"
print(result.corex_score) # float in [0, 1]
print(result.breakdown) # {"S": 0.91, "R": 0.88, "I": 0.85, "D": 0.90}
print(result.failure_modes) # list of detected failure modes (if any)
With Custom Weights
from corex import CausalEvaluator
evaluator = CausalEvaluator(
weights={
"statistical": 0.25,
"representation": 0.25,
"intervention": 0.30,
"domain": 0.20
}
)
result = evaluator.evaluate(X, Y, environments=env_labels)
With Learnable Inference Layer
from corex import CausalEvaluator
from corex.learnable import MetaScorer
meta = MetaScorer.from_pretrained("default")
evaluator = CausalEvaluator(meta_scorer=meta)
result = evaluator.evaluate(X, Y)
๐งฉ COREX Pipeline
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Raw Data D โ
โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
Statistical Representation Domain Shift
Module Module Module
(score S) (score R) (score D)
โ โ โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ
โ
โผ
Intervention Engine
(score I)
โ
โผ
Causal Scoring Layer
COREX = wโS + wโR + wโI + wโD
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Final Decision โ
โ ๐ข CAUSAL โ
โ ๐ก SPURIOUS โ
โ ๐ด ARTIFACT โ
โโโโโโโโโโโโโโโโโโโ
Module Descriptions
| # | Module | Formula | Description |
|---|---|---|---|
| 1 | Statistical Stability (S) | S = 1 - mean KL[P(Y|X,Dโ) โ P(Y|X,Dโ)] |
Cross-partition conditional invariance |
| 2 | Representation Invariance (R) | R = 1 - (1/|ฮฆ|) ฮฃ โP(Y|X) - P(Y|ฯ(X))โโ |
Stability under feature transformations |
| 3 | Intervention Consistency (I) | I = Consistency(do(X=xโ)โYโ, do(X=xโ)โYโ) |
Causal effect direction & magnitude stability |
| 4 | Domain Robustness (D) | D = 1 - CV(P(Y|X, e)) over e โ E |
Cross-environment generalization |
๐ Scoring Function
COREX = wโยทS + wโยทR + wโยทI + wโยทD
Default weights:
wโ = 0.25 (Statistical Stability)
wโ = 0.25 (Representation Invariance)
wโ = 0.30 (Intervention Consistency) โ highest weight: closest proxy to true causality
wโ = 0.20 (Domain Robustness)
Decision thresholds:
| Score Range | Classification | Condition |
|---|---|---|
COREX โฅ 0.80 |
๐ข CAUSAL | All modules stable; intervention confirmed |
0.50 โค COREX < 0.80 |
๐ก SPURIOUS CORRELATION | Domain shift or intervention failure detected |
COREX < 0.50 |
๐ด REPRESENTATION ARTIFACT | Representation invariance fails |
๐ Platforms & Mirrors
| Platform | URL | Role |
|---|---|---|
| ๐ GitHub (Primary) | github.com/gitdeeper12/COREX | Source code, issues, PRs |
| ๐ฆ GitLab (Mirror) | gitlab.com/gitdeeper12/COREX | CI/CD mirror |
| ๐ชฃ Bitbucket (Mirror) | bitbucket.org/gitdeeper-12/COREX | Enterprise mirror |
| ๐๏ธ Codeberg (Mirror) | codeberg.org/gitdeeper12/COREX | Open-source community |
| ๐ฆ PyPI | pypi.org/project/corex-causal-causal | Python package distribution |
| ๐ฌ Zenodo | doi.org/10.5281/zenodo.20351233 | Citable DOI, paper & data |
| ๐ OSF Project | osf.io/3ABZF | Research project registry |
| ๐ OSF Preregistration | doi.org/10.17605/OSF.IO/3ABZF | Pre-registered study protocol |
| ๐ Website | corex.netlify.app | Live documentation & dashboard |
| ๐งโ๐ฌ ORCID | orcid.org/0009-0003-8903-0029 | Researcher identity |
| ๐๏ธ Internet Archive | archive.org/details/osf-registrations-3ABZF | Permanent archival copy |
๐ Official Website Pages
| Page | URL |
|---|---|
| Homepage | corex.netlify.app |
| Dashboard | corex.netlify.app/dashboard |
| Results | corex.netlify.app/results |
| Documentation | corex.netlify.app/documentation |
๐ Clone & Download
Git Clone
# GitHub (Primary)
git clone https://github.com/gitdeeper12/COREX.git
# GitLab (Mirror)
git clone https://gitlab.com/gitdeeper12/COREX.git
# Bitbucket (Mirror)
git clone https://bitbucket.org/gitdeeper-12/COREX.git
# Codeberg (Mirror)
git clone https://codeberg.org/gitdeeper12/COREX.git
Direct ZIP Download
| Source | Link |
|---|---|
| GitHub | COREX-main.zip |
| GitLab | COREX-main.zip |
| Bitbucket | COREX-main.zip |
| Codeberg | COREX-main.zip |
| PyPI files | pypi.org/project/corex-causal-causal/#files |
| Zenodo record | doi.org/10.5281/zenodo.20351233 |
๐ Citation
If COREX contributes to your research, please cite using one of the following formats.
๐ฆ PyPI Package
@software{baladi2026corex_pypi,
author = {Baladi, Samir},
title = {{COREX}: Causal Origin Resolution and Empirical eXamination},
year = {2026},
version = {1.0.0},
publisher = {Python Package Index},
url = {https://pypi.org/project/corex-causal-causal-causal-causal},
note = {Python package, MIT License}
}
๐ฌ Zenodo Archive (Paper & Data)
@dataset{baladi2026corex_zenodo,
author = {Baladi, Samir},
title = {{COREX}: Causal Origin Resolution and Empirical eXamination โ Research Paper and Data},
year = {2026},
publisher = {Zenodo},
version = {1.0.0},
doi = {10.5281/zenodo.20351233},
url = {https://doi.org/10.5281/zenodo.20351233},
series = {BIO-MED-02}
}
๐ OSF Preregistration
@misc{baladi2026corex_osf,
author = {Baladi, Samir},
title = {{COREX} Framework: Pre-registered Study Protocol for Causal Discrimination in Data-Driven Models},
year = {2026},
publisher = {Open Science Framework},
doi = {10.17605/OSF.IO/3ABZF},
url = {https://doi.org/10.17605/OSF.IO/3ABZF},
note = {OSF Preregistration}
}
๐ Research Paper
@article{baladi2026corex,
author = {Baladi, Samir},
title = {{COREX}: An Autonomous Multi-Stage Framework for Robust Causal Discrimination in Data-Driven {AI} Systems},
year = {2026},
month = {May},
series = {BIO-MED-02},
version = {1.0.0},
doi = {10.5281/zenodo.20351233},
url = {https://doi.org/10.5281/zenodo.20351233},
note = {Ronin Institute / Rite of Renaissance}
}
APA (inline)
Baladi, S. (2026). COREX: An Autonomous Multi-Stage Framework for Robust Causal Discrimination in Data-Driven AI Systems (Version 1.0.0, Series BIO-MED-02). Zenodo. https://doi.org/10.5281/zenodo.20351233
๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
MIT License
Copyright (c) 2026 Samir Baladi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...
๐ค Author
Samir Baladi Interdisciplinary AI Researcher โ Neural Engineering & Biomedical AI Ronin Institute / Rite of Renaissance
| Contact | Link |
|---|---|
| ๐ง Email | gitdeeper@gmail.com |
| ๐งโ๐ฌ ORCID | 0009-0003-8903-0029 |
| ๐ GitHub | github.com/gitdeeper12 |
| ๐ Website | corex.netlify.app |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file corex_causal-1.0.0.tar.gz.
File metadata
- Download URL: corex_causal-1.0.0.tar.gz
- Upload date:
- Size: 41.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: COREX-Causal-Uploader/1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41cbd4d1a8abe5d6bf21addcd8d2b1ccc44cd4705b8ece296897d006483bb25d
|
|
| MD5 |
65320b48874050cabd8bf1787b25226d
|
|
| BLAKE2b-256 |
75a42162672cdf9692cb75c32581e97145c2db0dede67e5e78bfeb2a3489f96c
|
File details
Details for the file corex_causal-1.0.0-py3-none-any.whl.
File metadata
- Download URL: corex_causal-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: COREX-Causal-Uploader/1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cd1cad5f74df012b963834059c6952f6fc39f8328928bf65d1a6bfed667152a
|
|
| MD5 |
57a760418d4359c3e7b9ee4756d86ccc
|
|
| BLAKE2b-256 |
46c9eb9283ad4657a1bfcde6265e869836ea8ac394c9e55ead72bca41af5707f
|