This is the official codebase for the paper Bayesian Invariance Modeling of Multi-Environment Data (arXiv:2506.22675).
BIP is a Bayesian approach for discovering invariant predictors in multi-environment settings. The package provides two inference methods: BIP-exact, which performs exhaustive search over subsets of covariates (only feasible in low-dimensional settings or otherwise use it with pre-screening), and BIP-VI, which uses mean-field variational inference and is scalable to high-dimensional settings.
- Python 3.10
- conda (recommended)
-
Create a conda environment
conda create -n bip python=3.10 -y conda activate bip
-
Install dependencies
pip install -r requirements.txt
-
Install bip (editable mode)
pip install -e . -
(Optional) Install baselines package
Only required if you want to run experiments that compare against baseline methods (eills, causal_dantzig, causalicp):
pip install -e baselines
Quick start:
cd experiments/exp-synthetic
bash run.shPaper results replication: To replicate the experiments for different dimensionality settings:
cd experiments/exp-synthetic
bash run_lowdim_sweep.sh
bash run_meddim_sweep.sh
bash run_highdim_sweep.shAdditional dependencies:
pip install h5py
pip install hydra-coreRun experiments:
cd experiments/exp-gene
bash run.shbip/
├── src/bip/ # Main package (BIP)
├── baselines/ # Baseline methods (causal_dantzig, causalicp and eills)
│ └── src/
│ ├── eills/
│ ├── causal_dantzig/
│ └── causalicp/
├── experiments/ # Experiment scripts
│ ├── exp-synthetic/ # Synthetic data experiments
│ └── exp-gene/ # Gene expression experiments
└── requirements.txt # Python dependencies
If you use this codebase in your research, please cite:
@article{wu2025bayesian,
title={Bayesian Invariance Modeling of Multi-Environment Data},
author={Wu, Luhuan and Yin, Mingzhang and Wang, Yixin and Cunningham, John P and Blei, David M},
journal={arXiv preprint arXiv:2506.22675},
year={2025}
}