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.

Files for sumu, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size sumu-0.1.1-cp36-cp36m-macosx_10_9_x86_64.whl (512.2 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size sumu-0.1.1-cp36-cp36m-manylinux2010_x86_64.whl (2.7 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size sumu-0.1.1-cp36-cp36m-win_amd64.whl (402.5 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size sumu-0.1.1-cp37-cp37m-macosx_10_9_x86_64.whl (512.1 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size sumu-0.1.1-cp37-cp37m-manylinux2010_x86_64.whl (2.7 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size sumu-0.1.1-cp37-cp37m-win_amd64.whl (402.5 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size sumu-0.1.1-cp38-cp38-macosx_10_9_x86_64.whl (510.0 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size sumu-0.1.1-cp38-cp38-manylinux2010_x86_64.whl (2.9 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size sumu-0.1.1-cp38-cp38-win_amd64.whl (407.0 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size sumu-0.1.1.tar.gz (675.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page