COREX Documentation

Technical Documentation ยท API Reference ยท Graph-Free Causal Evaluation Framework

4
Evaluation Modules
91.4%
Accuracy
0.963
AUROC
3.2%
FPR
11
Platforms

๐Ÿ“– Overview

"Causality is not assumed, inferred, or interpreted โ€” it is survived or rejected under systematic perturbation tests."

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. The framework implements a four-axis evaluation pipeline โ€” Statistical Stability, Representation Invariance, Intervention Consistency, and Domain Robustness โ€” and fuses their outputs through a weighted scoring function to produce a calibrated causal classification.

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 audit pipeline to classify any observed X โ†’ Y relationship as CAUSAL, SPURIOUS, or REPRESENTATION ARTIFACT.

๐Ÿ—๏ธ 4-Module Architecture

Module 01 โ€” Statistical Stability (S)

Tests whether P(Y|X) remains invariant across independently drawn subpopulations of the data. Performs random stratified partitioning into k folds, estimates conditional distributions using kernel density estimation, and computes pairwise KL divergence across fold estimates.

Formula
S = 1 - mean_{iโ‰ j} KL[P(Y|X, D_i) โ€– P(Y|X, D_j)]

Module 02 โ€” Representation Invariance (R)

Evaluates whether the observed relationship persists when the feature representation of X is subjected to a structured family of transformations: linear projections, nonlinear embeddings, Gaussian noise injection, feature dropout, and PCA compression.

Formula
R = 1 - (1/|ฮฆ|) ฮฃ_ฯ† ||P(Y|X) - P(Y|ฯ†(X))||โ‚

Module 03 โ€” Intervention Consistency (I)

Simulates causal interventions by applying controlled perturbations to X and observing the consistency of the downstream effect on Y. Uses propensity-score matched observational comparisons and synthetic counterfactual generation.

Formula
I = Consistency(do(X=xโ‚)โ†’Yโ‚, do(X=xโ‚‚)โ†’Yโ‚‚)

Module 04 โ€” Domain Robustness (D)

Evaluates whether the predictive relationship generalizes across environments with distinct data-generating distributions. Constructs pseudo-environments through clustering in covariate space and assesses stability via coefficient of variation.

Formula
D = 1 - CV(P(Y|X, e)) over e โˆˆ E

๐Ÿ“ Core Equations

Statistical Stability
S = 1 โˆ’ mean KL[P(Y|X,Dโ‚) โ€– P(Y|X,Dโ‚‚)]
Cross-subpopulation conditional invariance
Representation Invariance
R = 1 โˆ’ (1/|ฮฆ|) ฮฃ โ€–P(Y|X) โˆ’ P(Y|ฯ†(X))โ€–โ‚
Stability under feature transformations
Intervention Consistency
I = Consistency(do(X=xโ‚)โ†’Yโ‚, do(X=xโ‚‚)โ†’Yโ‚‚)
Causal effect direction & magnitude stability
Domain Robustness
D = 1 โˆ’ CV(P(Y|X, e)) over e โˆˆ E
Cross-environment generalization

๐Ÿ“Š COREX Scoring Function

COREX Score Formula
COREX = wโ‚ยทS + wโ‚‚ยทR + wโ‚ƒยทI + wโ‚„ยทD
WeightValueModule
wโ‚0.25Statistical Stability
wโ‚‚0.25Representation Invariance
wโ‚ƒ0.30Intervention Consistency (highest)
wโ‚„0.20Domain Robustness
>

Decision Thresholds

LabelCOREX RangeInterpretation
๐ŸŸข CAUSALโ‰ฅ 0.80All four modules stable; intervention consistent
๐ŸŸก SPURIOUS0.50 โ€“ 0.79Domain shift OR intervention instability
๐Ÿ”ด ARTIFACT< 0.50Representation invariance fails

๐Ÿ“ฆ Installation

bash โ€” pip install
pip install corex

# From source
git clone https://github.com/gitdeeper12/COREX.git
cd COREX
pip install -e .

Core Dependencies: numpy, scipy

๐Ÿ”ง API Reference

python โ€” main interface
from corex import CausalEvaluator

# Initialize evaluator
evaluator = CausalEvaluator()

# Evaluate relationship between X and Y
result = evaluator.evaluate(X, y)

# Access results
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}

Parameters

ParameterDescriptionDefault
weightsCustom module weights{'statistical':0.25, 'representation':0.25, 'intervention':0.30, 'domain':0.20}
meta_scorerOptional learnable meta-layerNone

๐Ÿงฉ Core Modules

ModulePathDescription
statistical.pycorex/modules/statistical.pyStatistical Stability Module (S)
representation.pycorex/modules/representation.pyRepresentation Invariance Module (R)
domain.pycorex/modules/domain.pyDomain Robustness Module (D)
intervention.pycorex/modules/intervention.pyIntervention Consistency Engine (I)
score.pycorex/score.pyCOREX scoring function and thresholds
pipeline.pycorex/pipeline.pyMain evaluation pipeline

๐Ÿ“Š Validation Summary

MethodAccuracyAUROCFPR
COREX v1.0.091.4%0.9633.2%
IRM baseline76.0%0.87123.0%
Conditional Independence69.0%0.74131.0%
>

๐Ÿ‘ค Author

๐Ÿ”ฌ
Samir Baladi
Principal Investigator โ€” Causal Machine Learning & Biomedical AI
Samir Baladi is an independent interdisciplinary researcher affiliated with the Ronin Institute, developing the Rite of Renaissance research program. COREX is a framework for robust causal discrimination in data-driven AI systems.

๐Ÿ“ Citation

@software{baladi2026corex, author = {Baladi, Samir}, title = {COREX: Causal Origin Resolution and Empirical eXamination}, year = {2026}, version = {1.0.0}, doi = {10.5281/zenodo.20351233}, url = {https://github.com/gitdeeper12/COREX}, license = {MIT} }

"Causality is not assumed โ€” it is survived."