UUMCdata 0.0
Unitless, Unrestricted, Markov-Consistent Random SCM and Data Generation.
Keywords: benchmark, data generation, causal discovery

# UUMC SCM and Data Generation for Causal Benchmarking
Unitless, Unrestricted, Markov-Consistent Random Static (or Time Series, beta) SCM and Data Generation [[paper]](https://doi.org/10.48550/arXiv.2503.17037).

Our work focuses on generation of linear additive Gaussian Structural Causal Models (SCM) given a causal graph. In addition to our proposed approach, our package supports other approaches examined in the UUMC paper for comparison:
| Method | Description |
| :-- | :-- |
| [UUMC](https://doi.org/10.48550/arXiv.2503.17037) | Produces unitless, unrestricted, Markov-consistent SCMs. Introduced here; default option. |
| [unit-variance-noise](https://proceedings.neurips.cc/paper_files/paper/2018/file/e347c51419ffb23ca3fd5050202f9c3d-Paper.pdf) | Draws coefficients uniformly from [-HIGH, -LOW] U [LOW, HIGH], and sets all noise variances to 1. Defaults LOW=.5, HIGH=2. |
| [iSCM](https://arxiv.org/abs/2406.11601) | Begins with UVN SCM generation. The SCM is not complete until calling GEN_DATA. During data generation, the structural parameters (and data) for each variable are standardized by the sample standard deviation of the generated data before moving on to the next variable in the topological order. |
| [IPA](http://jmlr.org/papers/v21/17-123.html) | The structural parameters for each variable are scaled down by the variance the variable would have had if its parents were independent. |
| [50-50](https://proceedings.mlr.press/v177/squires22a.html) | Begins with UVN SCM generation. The SCM is not complete until calling GEN_DATA. During data generation, data for each variable is generated first without noise, then the causal coefficients and data are scaled down by $\sqrt{2}$ times the sample standard deviation to have a variance of 1/2, and noise with variance 1/2 is added before moving on to the next variable in the topological order. |
| [DaO](https://doi.org/10.48550/arXiv.2405.13100) | DAG Adaptation of the Onion Method. |
                  
To generate a random SCM and sample data from it ([example](https://github.com/Berlin-Office/UUMCdata/blob/main/examples/example.ipynb)):
1. Initialize a graph in a `CausalModel` or `tsCausalModel` object ([CausalModel.py](https://github.com/Berlin-Office/UUMCdata/blob/main/UUMCdata/CausalModel.py)). This can be done:
   * randomly using [Erdös-Rényi sampling](https://www.degruyter.com/document/doi/10.1515/9781400841356.38/pdf?licenseType=restricted)
   * from a user-provided array where $a_{ji}=1 \Leftrightarrow X_j \rightarrow X_i$. For time series, $a_{ji\tau}=1 \Leftrightarrow X_j(t-\tau)\rightarrow X_i(t)$.
2. Call `gen_coefficients()` on the CausalModel using the options from the table above. This sets the coefficient matrix `A` and the noise vector `s`. (Time series UUMC SCM generation is available, but under development.)
3. Call `gen_data()` on the CausalModel, providing the number of samples. This returns a `Data` or `TimeSeires` object ([Data.py](https://github.com/Berlin-Office/UUMCdata/blob/main/UUMCdata/Data.py)) which is also stored in the `data` attribute of the CausalModel.

[Var-](https://doi.org/10.48550/arXiv.2102.13647) and [R2-](https://proceedings.neurips.cc/paper_files/paper/2023/file/027e86facfe7c1ea52ca1fca7bc1402b-Paper-Conference.pdf)sortability can be examined by calling `sortability()` on the CausalModel. 

Large datasets over multiple SCMs can be generated using `CausalModel.gen_dataset()`, and [AnalysisPlotting.py](https://github.com/Berlin-Office/UUMCdata/blob/main/examples/AnalysisPlotting.py) and [UUMC.ipynb](https://github.com/Berlin-Office/UUMCdata/blob/main/examples/UUMC.ipynb) contain code that can be used to re-create figures from the UUMC paper.

## Citations
Please cite the following papers depending on which method you use:
- Paul Erdös and Alfréd Rényi. "On the evolution of random graphs." *Publ. Math. Inst. Hungar. Acad. Sci*, 5:17–61 (1960).
- Herman, Rebecca J., Jonas Wahl, Urmi Ninad, and Jakob Runge. "Unitless Unrestricted Markov-Consistent SCM Generation: Better Benchmark Datasets for Causal Discovery." *arXiv preprint* (2025). (For the 4th Conference on Causal Learning and Reasoning) [https://doi.org/10.48550/arXiv.2503.17037](https://doi.org/10.48550/arXiv.2503.17037)
- Xun Zheng, Bryon Aragam, Pradeep K Ravikumar, and Eric P Xing. "Dags with no tears: Continuous optimization for structure learning." In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett, editors, *Advances in Neural Information Processing Systems*, volume 31. Curran Associates, Inc. (2018). [https://proceedings.neurips.cc/paper_files/paper/2018/file/e347c51419ffb23ca3fd5050202f9c3d-Paper.pdf](https://proceedings.neurips.cc/paper_files/paper/2018/file/e347c51419ffb23ca3fd5050202f9c3d-Paper.pdf)
- Weronika Ormaniec, Scott Sussex, Lars Lorch, Bernhard Sch¨olkopf, and Andreas Krause. "Standardizing structural causal models" (2024). [https://arxiv.org/abs/2406.11601](https://arxiv.org/abs/2406.11601)
- Joris M. Mooij, Sara Magliacane, and Tom Claassen. "Joint causal inference from multiple contexts." *Journal of Machine Learning Research*, 21(99):1–108 (2020). [http://jmlr.org/papers/v21/17-123.html](http://jmlr.org/papers/v21/17-123.html)
- Chandler Squires, Annie Yun, Eshaan Nichani, Raj Agrawal, and Caroline Uhler. "Causal structure discovery between clusters of nodes induced by latent factors." In Bernhard Schölkopf, Caroline Uhler, and Kun Zhang, editors, *Proceedings of the First Conference on Causal Learning and Reasoning*, volume 177 of *Proceedings of Machine Learning Research*, pages 669–687. PMLR, 11–13 (Apr 2022). [https://proceedings.mlr.press/v177/squires22a.html](https://proceedings.mlr.press/v177/squires22a.html)
- Andrews, Bryan, and Erich Kummerfeld. "Better simulations for validating causal discovery with the dag-adaptation of the onion method." *arXiv preprint* (2024). [https://arxiv.org/abs/2405.13100](https://arxiv.org/abs/2405.13100)
- Alexander Reisach, Christof Seiler, and Sebastian Weichwald. "Beware of the simulated dag! causal discovery benchmarks may be easy to game." In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan, editors, *Advances in Neural Information Processing Systems*, volume 34, pages 27772–27784. Curran Associates, Inc. (2021). [https://proceedings.neurips.cc/paper_files/paper/2021/file/e987eff4a7c7b7e580d659feb6f60c1a-Paper.pdf](https://proceedings.neurips.cc/paper_files/paper/2021/file/e987eff4a7c7b7e580d659feb6f60c1a-Paper.pdf)
- Alexander Reisach, Myriam Tami, Christof Seiler, Antoine Chambaz, and Sebastian Weichwald. "A scale-invariant sorting criterion to find a causal order in additive noise models." In A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine, editors, Advances in Neural Information Processing Systems, volume 36, pages 785–807. Curran Associates, Inc. (2023). [https://proceedings.neurips.cc/paper_files/paper/2023/file/027e86facfe7c1ea52ca1fca7bc1402b-Paper-Conference.pdf](https://proceedings.neurips.cc/paper_files/paper/2023/file/027e86facfe7c1ea52ca1fca7bc1402b-Paper-Conference.pdf)