Library for working with probabilistic and causal graphical models
Project description
Sumu
Sumu is a Python library for working with probabilistic and causal graphical models, developed at the Sums of Products research group at the University of Helsinki.
The library aims to facilitate:
- Academic workflows, by giving modular access to highly optimized low level algorithms.
- Industry workflows, by providing easy to use wrappers using the low level components for well-defined practical use cases.
The library in its current state is very much a work-in-progress.
sumu
- Finnish: Very thick vapor obscuring the visibility near the ground, translated usually as "mist" or "fog".
- Japanese (澄む): For the weather to clear up; become clear, become transparent.
- Bunch of other meanings not worthy of mention.
Installation
You will probably want to install this in a conda environment, so you should first install conda, if you haven't already, and create an environment. Sumu has been tested to work with Python versions 3.6, 3.7 and 3.8.
The easiest way to install the package is by running pip install sumu
.
To alternatively install from sources you should clone the repository and run pip install .
in the repository root.
Finally, if you wish to work on the source code it is preferable to install with pip install --verbose --no-build-isolation --editable .
as it allows you to modify the Python code without reinstallation. Any changes to compiled code (i.e., C++ or Cython) will still need to be recompiled by running the same pip
command. For the editable
install to work you first need to install the build dependencies, that is Cython>=0.29.17
and Numpy
.
Features
Sumu, at the moment, implements the following core algorithms:
- Gadget (Generating Acyclic DiGraphs from Target) for MCMC sampling of DAGs [1].
- Beeps (Bayesian Estimation of Effect Posterior by Sampling) for sampling from the posterior of linear causal effects [1].
- APS (All Parent Sets) for computing for each variable and parent set the total weight of DAGs where that variable has those parents [2].
Additionally, the library includes supporting functionality, for example functions for local score computations.
TODO: Proper documentation of the library and its features.
Getting started
import sumu
data = sumu.Data(path_to_continuous_data.csv, discrete=False)
params = {"data": data,
"scoref": "bge", # Or "bdeu" for discrete data.
"ess": 10, # If using BDeu.
"max_id": -1,
"K": 15,
"d": 3,
"cp_algo": "greedy-lite",
"mc3_chains": 16,
"burn_in": 10000,
"iterations": 10000,
"thinning": 10}
g = sumu.Gadget(**params)
dags, scores = g.sample()
# The following only for continuous data
dags = [sumu.bnet.family_sequence_to_adj_mat(dag) for dag in dags]
causal_effects = sumu.beeps(dags, data)
Citing
If you use the library in your research work please cite the appropriate sources. For APS you should cite [2] and for everything else [1].
References
[1] Jussi Viinikka, Antti Hyttinen, Johan Pensar, and Mikko Koivisto. Towards Scalable Bayesian Learning of Causal DAGs. In NeurIPS 2020, in press.
[2] Johan Pensar, Topi Talvitie, Antti Hyttinen, and Mikko Koivisto. A Bayesian approach for estimating causal effects from observational data. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020. AAAI Press, 2020.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for sumu-0.1.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43682d21f05b43eec3eb5278d2ffa29d94c458038b869a4e061c009e4f38aee9 |
|
MD5 | 8b5f7cf08a904ece82f28865f4b71656 |
|
BLAKE2b-256 | d1b6cc3101ad169fe9dab9c3c64117ac69a1b25f15ffef90f96ec4a1f5cedf86 |
Hashes for sumu-0.1.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba8c4b132f138a96b2955fa4b51749c70299dcf319efe5b71c0583c4e0b7c796 |
|
MD5 | 6ea78257a55cb9ad446d3478121b2780 |
|
BLAKE2b-256 | 6d4b9c63785c44b5fb4628b1ecf10f0b39bc3e895eab443ceda988c357a7c005 |
Hashes for sumu-0.1.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f87c1ff33863f1c36cdd577c9bbdef1454da151260380ca5986a14346156a9d |
|
MD5 | 74f5e666bd3821132f992512f22b69c0 |
|
BLAKE2b-256 | f8a82d07bab39b43f5176440cf15d279cb85cf3b5b697ecfab134c02edb859bd |
Hashes for sumu-0.1.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1959bb3a6da63c191579dc655b53427b06cda87d0173491a9f985a9e2370127 |
|
MD5 | fba8e6860ee7e389cccc26137d9efa65 |
|
BLAKE2b-256 | 40964efc4c763be38cf014a241d44c74e5dd9111b4d21f30890a48d6ab6b8cb6 |
Hashes for sumu-0.1.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf98a2102afc57a1049730a6917ddbe55dbe302c04202edec7bb15e5c0e8389f |
|
MD5 | 7147811e497c6599b8c1b0cabb2f3a83 |
|
BLAKE2b-256 | 91d949e52f2b3c08c25235bc6f4dce31e7f4e7266d92ccbd137d9396cd2dcd5c |
Hashes for sumu-0.1.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e2ed04c021fb0711030376b332fbb17f4585ebb90d70beb67000fab7b47eb9d |
|
MD5 | 5814522863ca4920869cc0f4158b5450 |
|
BLAKE2b-256 | d2eb8f2e5fbbddbd7aecf244200cc8732ae6595d669c85adeb81c3215b6ac97c |
Hashes for sumu-0.1.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 996be18bf37767c8ea8cb8ce542185c4d23dd6561172fcef0b8bc98fb7e34db1 |
|
MD5 | 7d35ddb8f210d67744f3a999e4ed9fd2 |
|
BLAKE2b-256 | 715d7642f7eefa2ae359c4329063f35212bb5e60ed5989bd296cc4c239696425 |
Hashes for sumu-0.1.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed9ec9fef3e8b1964550ff205ed3f3fcf18833fa6a68ea969564450f956d61cb |
|
MD5 | 21021979ca720f6d16bf08bbe0d6fddd |
|
BLAKE2b-256 | ef60ff42361bb8ce7c93146fe22372263abb1d3902b08c5a24b5495d7c688ef6 |
Hashes for sumu-0.1.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06509a02996a610a99050a909c5c875d95bdfcc16cdc821e9eeddc5253cf1d38 |
|
MD5 | 1becfa189fbe350460eb7a7cbb043e4e |
|
BLAKE2b-256 | 3e48e60a4d9e54a46d70bdd65396c90f5aa649fa912850123aab06a5e59ec22a |