Skip to main content

Thomas, a library for working with Bayesian Networks.

Project description

Coverage Status Build Status badge


Very simple (almost naive ;-) bayesian network implementation.

Example (module thomas.core.examples) contains examples from the book "Probabilistic Graphical Models: Principles and Techniques" from Koller and Friedman (PGM Stanford) and from the lecture by Adnan Darwiche on YouTube:



To install from PyPI use pip:

    pip install thomas-core


To do a development install:

    git clone
    cd thomas-core
    pip install -e .


A Docker image is available for easy deployment. The following command will start a JupyterLab server, listening on localhost, port 8888:

    docker run --rm -it -p 8888:8888 mellesies/thomas-core


To get started with querying a network, try the following:

from thomas.core import examples

# Load an example network
Gs = examples.get_student_network()

# This should output the prior probability of random variable 'S' (SAT score).

# Expected output:
# P(S)
# S
# s0    0.725
# s1    0.275
# dtype: float64

# Query for the conditional probability of S given the student is intelligent.

# Expected output:
# P(S)
# S
# s0    0.2
# s1    0.8
# dtype: float64

Alternatively, you can have a go at the example notebooks through Binder:

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 thomas-core, version 0.1.0a16
Filename, size File type Python version Upload date Hashes
Filename, size thomas_core-0.1.0a16-py3-none-any.whl (74.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size thomas-core-0.1.0a16.tar.gz (671.2 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