How uzairakbar/symmetry4causalbounds works
Purpose and execution
This repository implements experiments for symmetry-constrained causal partial identification: estimating causal-effect bounds by combining structural causal models, data augmentations encoding symmetries, and sensitivity/regression methods. The main batch entry point is src/main.py, which reads experiment selection and parameters from config.yaml; outputs are intended for artifacts/.
Experiment orchestration
src/experiments/generic_runner.py provides the common execution path, with experiment-specific runners for digit, optical-device, and synthetic simulation settings:
• src/experiments/do_mnist.py
• src/experiments/optical_device.py
• src/experiments/simulation.py
Shared lifecycle/configuration abstractions reside in src/experiments/base.py and src/experiments/configs.py. These form the boundary between declarative experiment configuration and model/data/method execution.
Structural causal environments
The sem package defines the data-generating causal environments used to evaluate identification bounds. src/sem/abstract.py establishes the common SEM interface; concrete implementations encode domain-specific causal mechanisms:
• src/sem/do_mnist.py
• src/sem/optical_device.py
• src/sem/simulation.py
src/sem/cmnist.py supplies a colored-MNIST-style environment. These modules are the source of observational/interventional or simulated causal data consumed downstream.
Symmetry and augmentation layer
src/data_augmentors/abstract.py defines augmentation behavior that operationalizes domain symmetries. Concrete augmentors align with experimental domains:
• src/data_augmentors/do_mnist.py
• src/data_augmentors/optical_device.py
• src/data_augmentors/simulation.py
This layer sits between raw SEM/domain data and learning methods, producing symmetry-related samples or transformations used to constrain causal partial identification.
Causal-bound methods
src/methods/abstract.py defines the method contract. The principal implementation appears to be CoPSens, with both standard and JAX-backed variants:
• src/methods/copsens.py
• src/methods/copsens_jax.py
Regression and sensitivity-model components support fitting and bound computation:
• src/methods/regression.py
• src/methods/sensitivity_models.py
• src/methods/nets.py
The key control flow is experiment runner → SEM/data and augmentation construction → method fitting/optimization → estimated causal bounds and diagnostics.
Oracle and evaluation boundary
src/oracle.py provides a distinct oracle layer, likely used where ground-truth causal quantities are available from the simulated SEMs. Experiment utilities handle data operations, fitting, metrics, panel construction, and plotting:
• src/experiments/utils/model_fitting.py
• src/experiments/utils/metrics.py
• src/experiments/utils/plotting.py
This separates learned partial-identification outputs from oracle comparison and report generation.
Runtime and infrastructure
The project is Python-based, with package/dependency metadata in pyproject.toml. It supports local Python environments and containerized execution through Dockerfile. PyTorch is a material runtime, while src/methods/copsens_jax.py indicates JAX is also used for an alternate computational backend. Docker mounts data/ and artifacts/, preserving datasets and generated figures/results outside the container.
Main entry points: generic_runner.py Generic runner · copsens.py CoPSens · do_mnist.py Domain SEMs · metrics.py Metrics and fitting utilities
Components 18
Execution
- Batch entry point · Selects and parameterizes experiments.
src/main.py - Experiment config
config.yaml
Experiment orchestration
- Lifecycle and configs
src/experiments/base.py - Generic runner · Builds domain components and runs the common experiment lifecycle.
src/experiments/generic_runner.py - Domain runners
src/experiments/do_mnist.py
Causal environments
- SEM interface
src/sem/abstract.py - Domain SEMs · Generate observational, interventional, or simulated causal data.
src/sem/do_mnist.py - Colored-MNIST SEM
src/sem/cmnist.py
Symmetry and bounds
- Augmentation interface
src/data_augmentors/abstract.py - Domain augmentors · Produce symmetry-related samples for identification constraints.
src/data_augmentors/do_mnist.py - Method interface
src/methods/abstract.py - CoPSens · Fits symmetry-constrained partial-identification bounds.
src/methods/copsens.py - JAX CoPSens
src/methods/copsens_jax.py - Regression and sensitivity models
src/methods/regression.py
Evaluation and outputs
- Oracle
src/oracle.py - Metrics and fitting utilities
src/experiments/utils/metrics.py - Plots and reports
src/experiments/utils/plotting.py - Artifacts · Mounted output directory for experiment results.
Connections 23
- Experiment config → Batch entry point: parameters
- Batch entry point → Generic runner: dispatches
- Batch entry point → Domain runners: selects domain
- Lifecycle and configs → Generic runner: lifecycle contract
- Domain runners → Generic runner: uses common path
- Generic runner → SEM interface: constructs
- SEM interface → Domain SEMs: implemented by
- SEM interface → Colored-MNIST SEM: implemented by
- Generic runner → Augmentation interface: constructs
- Augmentation interface → Domain augmentors: implemented by
- Domain SEMs → Domain augmentors: raw causal data
- Generic runner → Method interface: selects method
- Method interface → CoPSens: implemented by
- CoPSens → JAX CoPSens: alternate backend
- Regression and sensitivity models → CoPSens: regression and sensitivity fitting
- Domain augmentors → CoPSens: symmetry samples
- Domain SEMs → CoPSens: causal data
- Domain SEMs → Oracle: ground truth
- CoPSens → Metrics and fitting utilities: estimated bounds and diagnostics
- Oracle → Metrics and fitting utilities: comparison targets
- Metrics and fitting utilities → Plots and reports: evaluation results
- Plots and reports → Artifacts: figures and reports
- Metrics and fitting utilities → Artifacts: results