Skip to main content

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

  1. Finnish: Very thick vapor obscuring the visibility near the ground, translated usually as "mist" or "fog".
  2. Japanese (澄む): For the weather to clear up; become clear, become transparent.
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sumu-0.1.2.tar.gz (677.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sumu-0.1.2-cp38-cp38-win_amd64.whl (407.2 kB view details)

Uploaded CPython 3.8Windows x86-64

sumu-0.1.2-cp38-cp38-manylinux2010_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

sumu-0.1.2-cp38-cp38-macosx_10_9_x86_64.whl (511.2 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

sumu-0.1.2-cp37-cp37m-win_amd64.whl (402.6 kB view details)

Uploaded CPython 3.7mWindows x86-64

sumu-0.1.2-cp37-cp37m-manylinux2010_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

sumu-0.1.2-cp37-cp37m-macosx_10_9_x86_64.whl (513.1 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

sumu-0.1.2-cp36-cp36m-win_amd64.whl (402.2 kB view details)

Uploaded CPython 3.6mWindows x86-64

sumu-0.1.2-cp36-cp36m-manylinux2010_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

sumu-0.1.2-cp36-cp36m-macosx_10_9_x86_64.whl (512.2 kB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

Details for the file sumu-0.1.2.tar.gz.

File metadata

  • Download URL: sumu-0.1.2.tar.gz
  • Upload date:
  • Size: 677.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sumu-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4088d47840e7dbd3b0fe736416e6d1f3a3a815fae50db9467783aefd9c08cd79
MD5 9ddcacc3a6023dc41e934f9351355402
BLAKE2b-256 e4649a8040150bc27bd77785d9e98e1d473c29f420a0815e03785279d4765192

See more details on using hashes here.

File details

Details for the file sumu-0.1.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: sumu-0.1.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 407.2 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sumu-0.1.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 43682d21f05b43eec3eb5278d2ffa29d94c458038b869a4e061c009e4f38aee9
MD5 8b5f7cf08a904ece82f28865f4b71656
BLAKE2b-256 d1b6cc3101ad169fe9dab9c3c64117ac69a1b25f15ffef90f96ec4a1f5cedf86

See more details on using hashes here.

File details

Details for the file sumu-0.1.2-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: sumu-0.1.2-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sumu-0.1.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ba8c4b132f138a96b2955fa4b51749c70299dcf319efe5b71c0583c4e0b7c796
MD5 6ea78257a55cb9ad446d3478121b2780
BLAKE2b-256 6d4b9c63785c44b5fb4628b1ecf10f0b39bc3e895eab443ceda988c357a7c005

See more details on using hashes here.

File details

Details for the file sumu-0.1.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: sumu-0.1.2-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 511.2 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sumu-0.1.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3f87c1ff33863f1c36cdd577c9bbdef1454da151260380ca5986a14346156a9d
MD5 74f5e666bd3821132f992512f22b69c0
BLAKE2b-256 f8a82d07bab39b43f5176440cf15d279cb85cf3b5b697ecfab134c02edb859bd

See more details on using hashes here.

File details

Details for the file sumu-0.1.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: sumu-0.1.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 402.6 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sumu-0.1.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 e1959bb3a6da63c191579dc655b53427b06cda87d0173491a9f985a9e2370127
MD5 fba8e6860ee7e389cccc26137d9efa65
BLAKE2b-256 40964efc4c763be38cf014a241d44c74e5dd9111b4d21f30890a48d6ab6b8cb6

See more details on using hashes here.

File details

Details for the file sumu-0.1.2-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: sumu-0.1.2-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sumu-0.1.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 bf98a2102afc57a1049730a6917ddbe55dbe302c04202edec7bb15e5c0e8389f
MD5 7147811e497c6599b8c1b0cabb2f3a83
BLAKE2b-256 91d949e52f2b3c08c25235bc6f4dce31e7f4e7266d92ccbd137d9396cd2dcd5c

See more details on using hashes here.

File details

Details for the file sumu-0.1.2-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: sumu-0.1.2-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 513.1 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sumu-0.1.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9e2ed04c021fb0711030376b332fbb17f4585ebb90d70beb67000fab7b47eb9d
MD5 5814522863ca4920869cc0f4158b5450
BLAKE2b-256 d2eb8f2e5fbbddbd7aecf244200cc8732ae6595d669c85adeb81c3215b6ac97c

See more details on using hashes here.

File details

Details for the file sumu-0.1.2-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: sumu-0.1.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 402.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sumu-0.1.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 996be18bf37767c8ea8cb8ce542185c4d23dd6561172fcef0b8bc98fb7e34db1
MD5 7d35ddb8f210d67744f3a999e4ed9fd2
BLAKE2b-256 715d7642f7eefa2ae359c4329063f35212bb5e60ed5989bd296cc4c239696425

See more details on using hashes here.

File details

Details for the file sumu-0.1.2-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: sumu-0.1.2-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sumu-0.1.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ed9ec9fef3e8b1964550ff205ed3f3fcf18833fa6a68ea969564450f956d61cb
MD5 21021979ca720f6d16bf08bbe0d6fddd
BLAKE2b-256 ef60ff42361bb8ce7c93146fe22372263abb1d3902b08c5a24b5495d7c688ef6

See more details on using hashes here.

File details

Details for the file sumu-0.1.2-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: sumu-0.1.2-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 512.2 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sumu-0.1.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 06509a02996a610a99050a909c5c875d95bdfcc16cdc821e9eeddc5253cf1d38
MD5 1becfa189fbe350460eb7a7cbb043e4e
BLAKE2b-256 3e48e60a4d9e54a46d70bdd65396c90f5aa649fa912850123aab06a5e59ec22a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page