CSuite: A Suite of Benchmark Datasets for Causality
May 9, 2023 · View on GitHub
CSuite is a collection of synthetic datasets for benchmarking causal machine learning algorithms. Each dataset consists of
- the true causal graph, for benchmarking causal discovery;
- 4000 rows of observational training data;
- 2000 rows of observational test data;
- interventional test data, for benchmarking estimation of average treatment effect (ATE) and conditional average treatment effect (CATE), 2000 rows per interventional environment.
The data was generated from known hand-crafted structural equation models (SEMs). Different datasets are intended to test different features of causal discovery and inference algorithms. CSuite was originally introduced in this paper. The data generation code for CSuite is publicly available.
Versioning
CSuite datasets are versioned so that we can amend and add datasets, whilst ensuring backwards compatibility with older versions of the data. Full reproducibility with CSuite requires specifying the correct version.
Summary of datasets
The download URLs here are for the latest version.
Data format
Each dataset consists of the following files
adj_matrix.csv, which describes the causal graph used to generate the data; a value1in rowi, columnjindicates an edge from nodeito nodej;train.csv, the observational training data;test.csv, the observational test data;interventions.json, a JSON containing interventional test data.
The interventional data JSON consists of pairs of interventional environments, which can be used to estimate (C)ATE. The two environments are the 'primary' and 'reference' environments. Conditional data was generating using HMC. The format of the interventional data is
{
"environments": [
{
"conditioning_idxs": <optional list containing indices of nodes to that were conditioned on>,
"conditioning_values": <list of values set on the conditioning nodes>,
"effect_idxs": <list containing indices of nodes to be considered effect variables>,
"intervention_idxs": <list of indices of nodes that were acted on with do-intervention>,
"intervention_values": <list of values set on the intervention nodes in the primary do-intervention: for example, receiving a medicine>,
"intervention_reference": <list of values set on the intervention nodes in the reference do-intervention: for example, not receiving the medicine>,
"test_data": <array of data from the primary do-intervention, same number of columns as train.csv>,
"reference_data": <array of data from the reference do-intervention>
},
...
],
"metadata": {
"columns_to_nodes": <matches to columns to their corresponding nodes, only important for vector-values nodes>
}
}
Download
From the terminal
You can download CSuite datasets from any previous version using the following URL pattern
$ curl -O https://github.com/microsoft/csuite/releases/download/v<version>/csuite_<name>.zip
where <name> and <version> should be set appropriately.
From Python
The uncompressed files listed under Data format are also directly available from a public storage account. These may either be accessed through their HTTP links, e.g. https://azuastoragepublic.blob.core.windows.net/datasets/csuite_linexp/train.csv or their equivalent Azure blob storage paths. To load these directly in python:
import pandas as pd
# Load over HTTP
df = pd.read_csv("https://azuastoragepublic.blob.core.windows.net/datasets/csuite_linexp/train.csv")
# Load using `adlfs` (`pip install adlfs`)
df = pd.read_csv("az://datasets@azuastoragepublic.blob.core.windows.net/csuite_linexp/train.csv")
Citation
If you use CSuite datasets in your work, please cite the following paper which originally introduced these datasets
@article{geffner2022deep,
title={Deep End-to-end Causal Inference},
author={Geffner, Tomas and Antoran, Javier and Foster, Adam and Gong, Wenbo and Ma, Chao and Kiciman, Emre and Sharma, Amit and Lamb, Angus and Kukla, Martin and Pawlowski, Nick and Allamanis, Miltiadis and Zhang, Cheng},
journal={arXiv preprint arXiv:2202.02195},
year={2022}
}
Detailed descriptions of datasets
lingauss
A two node linear Gaussian system. The structural equations are
where is independent of . The dataset is constructed so that the observational distribution is the same if and are swapped and both nodes have the same marginal variance of 1. This model is not structural identifiable from observational data.
linexp
A two node linear system with exponentially distributed noise. The structural equations are
where are independent variables. The dataset is constructed so that both nodes have the same marginal variance of 1. This model is structural identifiable given a non-Gaussian additive noise assumption.
nonlingauss
A two node non-linear system with Gaussian distributed noise. The structural equations are
\begin{align} X_0 &\sim N(0,1) \\ X_1 &= \sqrt{6} \exp(-X_$0^{2}$) + \alpha Z_1 \end{align}where is independent of and
The dataset is constructed so that and . This model is structural identifiable given a nonlinear additive noise assumption.
nonlin_simpson
An example of Simpson's Paradox using a continuous SEM. The dataset is constructed so that has the opposite sign to . Estimating the treatment effects correctly in this SEM is highly sensitive to accurate causal discovery.
The structural equations are
where and are mutually independent and independent of , is the softplus function. Constants were chosen so that each variable has a marginal variance of (approximately) 1.
symprod_simpson
A dataset exhibiting multi-modality that is suitable for benchmarking CATE estimation. Nonlinear function estimation is important since .
The structural equations are
where and are mutually independent and independent of . Constants were chosen so that each variable has a marginal variance of (approximately) 1.
large_backdoor
A larger dataset with a pyramidal graph structure. This dataset is constructed so that there are many possible choices of backdoor adjustment set for estimating the treatment effect of on . While both minimal and maximal adjustment sets can result in a correct solution, the a minimal adjustment set results in a much lower-dimensional adjustment problem and thus will result in lower variance solutions.
A complete description of the structural equations can be found in the data generation code for CSuite.
weak_arrows
A larger dataset that is similar to large_backdoor, but with many additional edges. The causal discovery challenge revolves
around finding all arrows, which are scaled to be relatively weak, but which have significant predictive power for in aggregate.
A complete description of the structural equations can be found in the data generation code for CSuite.
cat_to_cts
| Variable | Discrete/continuous |
|---|---|
| Discrete on | |
| Continuous |
A two node system with one categorical and one continuous variable. The structural equations are
where is the softplus function, and is independent of .
cts_to_cat
| Variable | Discrete/continuous |
|---|---|
| Continuous | |
| Discrete on |
A two node system with one categorical and one continuous variable. The structural equations are
mixed_simpson
| Variable | Discrete/continuous |
|---|---|
| Discrete on | |
| Continuous | |
| Discrete on | |
| Continuous |
Another example of Simpson's Paradox using a mixed-type SEM. The dataset is constructed so that has the opposite sign to . Estimating the treatment effects correctly in this SEM is highly sensitive to accurate causal discovery.
The structural equations are
where are independent noise random variables and .
large_backdoor_binary_t
| Variable | Discrete/continuous |
|---|---|
| Continuous | |
| Continuous | |
| Continuous | |
| Continuous | |
| Continuous | |
| Continuous | |
| Continuous | |
| Discrete on | |
| Continuous |
An adaptation of large_backdoor with a binary variable which is considered the treatment variable.
A complete description of the structural equations can be found in the data generation code for CSuite.
weak_arrow_binary_t
| Variable | Discrete/continuous |
|---|---|
| Continuous | |
| Continuous | |
| Continuous | |
| Continuous | |
| Continuous | |
| Continuous | |
| Continuous | |
| Discrete on | |
| Continuous |
An adaptation of weak_arrows with a binary variable which is considered the treatment variable.
A complete description of the structural equations can be found in the data generation code for CSuite.
mixed_confounding
| Variable | Discrete/continuous |
|---|---|
| Discrete on | |
| Continuous | |
| Continuous | |
| Continuous | |
| Discrete on | |
| Discrete on | |
| Continuous | |
| Discrete on | |
| Continuous | |
| Continuous | |
| Continuous | |
| Continuous |
A larger dataset with treatment node and outcome node . There are different variables that are: confounders, causes of only, causes of only, downstream of , downstream of , collider caused by and .
A complete description of the structural equations can be found in the data generation code for CSuite.
cat_chain
| Variable | Discrete/continuous |
|---|---|
| Discrete on | |
| Discrete on | |
| Discrete on |
A chain graph with discrete variables. The structural equations are
cat_collider
| Variable | Discrete/continuous |
|---|---|
| Discrete on | |
| Discrete on | |
| Discrete on |
A collider graph with discrete variables. The structural equations are
Contributing
This project welcomes contributions and suggestions.
Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.