Skip to main content

The Sum-Product Probabilistic Language

Project description

Actions Status pypi

Sum-Product Probabilistic Language

SPPL is a probabilistic programming language that delivers exact solutions to a broad range of probabilistic inference queries. SPPL handles continuous, discrete, and mixed-type distributions; many-to-one numerical transformations; and a query language that includes general predicates on random variables.

Users express generative models as imperative programs with standard programming constructs, such as arrays, if/else, for loops, etc. The program is then translated to a sum-product representation (a generalization of sum-product networks) that statically represents the probability distribution on all random variables in the program and is used as the basis of probabilistic inference.

A system description of SPPL is given in:

Exact Symbolic Inference in Probabilistic Programs via Sum-Product Representations.
Feras A. Saad, Martin C. Rinard, and Vikash K. Mansinghka.
https://arxiv.org/abs/2010.03485

Installation

This software is tested on Ubuntu 18.04 and requires a Python 3.6+ environment. SPPL is available on PyPI

$ pip install sppl

To install the Jupyter interface, first obtain the system-wide dependencies in requirements.sh and then run

pip install 'sppl[magics]'

Examples

The easiest way to use SPPL is via the browser-based Jupyter interface, which allows for interactive modeling, querying, and plotting. Refer to the .ipynb notebooks under the examples directory.

Benchmarks

Refer to https://github.com/probcomp/sppl-benchmarks-oct20

Language Reference

Coming Soon!

Tests

To run the test suite as a user, first install with pip install 'sppl[tests]' and then run:

$ python -m pytest --pyargs sppl

To run the test suite as a developer:

  • To run crash tests: $ ./check.sh
  • To run integration tests: $ ./check.sh ci
  • To run a specific test: $ ./check.sh [<pytest-opts>] /path/to/test.py
  • To run the examples: $ ./check.sh examples
  • To build a docker image: $ ./check.sh docker
  • To generate a coverage report: $ ./check.sh coverage

To view the coverage report, open htmlcov/index.html in the browser.

License

Apache 2.0; see LICENSE.txt

Acknowledgments

The logo was designed by McCoy R. Becker.

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

sppl-1.2.0.tar.gz (70.1 kB view details)

Uploaded Source

Built Distribution

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

sppl-1.2.0-py3-none-any.whl (91.8 kB view details)

Uploaded Python 3

File details

Details for the file sppl-1.2.0.tar.gz.

File metadata

  • Download URL: sppl-1.2.0.tar.gz
  • Upload date:
  • Size: 70.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.9

File hashes

Hashes for sppl-1.2.0.tar.gz
Algorithm Hash digest
SHA256 68eea4e425e502d242ed7b627155e4ae68c9b46dc1efe01865191ceaae0a94aa
MD5 b17cac4a86e44a62940d84333367f3cb
BLAKE2b-256 5a1d29320f2d9b56b80455fdf182a9b6449aedc2a17c6414546f1535d05f6e14

See more details on using hashes here.

File details

Details for the file sppl-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: sppl-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 91.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.9

File hashes

Hashes for sppl-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08fc9960cff570d40a38344ec5ec5dd43e8bb3ac1031bdc098a77b3e78b1c549
MD5 4472f4aaf9295c650d1570f495dc4bc4
BLAKE2b-256 3480649f27f1588680d5651be1ce4805de65da54545480092f2a97ca28edaa48

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