Skip to content

LuhuanWu/BayesianInvariantPrediction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BIP (Bayesian Invariant Prediction)

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.

Installation

Prerequisites

  • Python 3.10
  • conda (recommended)

Setup Instructions

  1. Create a conda environment

    conda create -n bip python=3.10 -y
    conda activate bip
  2. Install dependencies

    pip install -r requirements.txt
  3. Install bip (editable mode)

    pip install -e .
  4. (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

Running Experiments

Synthetic Experiments

Quick start:

cd experiments/exp-synthetic
bash run.sh

Paper 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.sh

Gene Expression Experiments

Additional dependencies:

pip install h5py
pip install hydra-core

Run experiments:

cd experiments/exp-gene
bash run.sh

Project Structure

bip/
├── 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

Citation

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}
}

About

Codes for Bayesian Invariance Modeling of Multi-Environment Data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors