counterfactualms
counterfactualms copied to clipboard
counterfactuals for magnetic resonance images of multiple sclerosis
SCM for MR images of MS
This repository holds code to generate counterfactual images of MR brain images for people with (and without) MS using a structural causal model (SCM) [1] built in Pyro.
This code was used to generate the counterfactual images in our paper "A Structural Causal Model of MR Images of Multiple Sclerosis".
Our work builds on the work of Pawlowski, Castro, and Glocker [2]. The code in this repository is a fork of their code which can be found here.
The code for the segmentation experiment in our paper can be found here; it depends on msseg. The exact hyperparameters and information about the data used for the segmentation experiment are in the docstring of that script.
This package was developed by Jacob Reinhold of the Image Analysis and Communication Lab (IACL).
Installation
From inside this directory, run:
python setup.py install
or (if you'd like to make updates to the package)
python setup.py develop
Structure
This repository contains code and assets structured as follows:
-
counterfactualms/
: contains the code used for running the experiments-
arch/
: model architectures used in experiments -
datasets/
: script for dataset generation and data loading used in experiments -
distributions/
: implementations of useful distributions or transformations -
experiments/
: implementation of experiments
-
-
assets/
: contains hyperparameters for the experiments listed in the paper
References
- Pearl, Judea. Causality. Cambridge university press, 2009.
- Pawlowski, Nick, Daniel Coelho de Castro, and Ben Glocker. "Deep Structural Causal Models for Tractable Counterfactual Inference." Advances in Neural Information Processing Systems 33 (2020).