Skip to main content

Thomas, a library for working with Bayesian Networks.

Project description

Coverage Status Build Status badge

Thomas

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:

Installation

Normal

To install from PyPI use pip:

$ pip install thomas-core

Development

To do a development install:

$ git clone https://github.com/mellesies/thomas-core
$ cd thomas-core
$ pip install -e .

Usage

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).
print(Gs.P('S'))
print()

# 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.
print(Gs.P('S|I=i1'))

# 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.

Source Distribution

thomas-core-0.1.0a2.tar.gz (670.8 kB view details)

Uploaded Source

Built Distribution

thomas_core-0.1.0a2-py3-none-any.whl (74.5 kB view details)

Uploaded Python 3

File details

Details for the file thomas-core-0.1.0a2.tar.gz.

File metadata

  • Download URL: thomas-core-0.1.0a2.tar.gz
  • Upload date:
  • Size: 670.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for thomas-core-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 5129dce50775649596dfd32766f6c89cd22435f3531ffdb9958887fbc97566f1
MD5 3adb7c86b0eff0c253982625e83ee16a
BLAKE2b-256 97cf22209fb838efc25e26811743b0cb547ffb263fd26a7e84ecc43afd06d56a

See more details on using hashes here.

File details

Details for the file thomas_core-0.1.0a2-py3-none-any.whl.

File metadata

  • Download URL: thomas_core-0.1.0a2-py3-none-any.whl
  • Upload date:
  • Size: 74.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for thomas_core-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 71a0e8549a447cb822b239de8b67fee53b26ef56b93b0cf02165d4a800008edc
MD5 f92b68da713d851c78f99c5092cfb75d
BLAKE2b-256 f8daab96254baf232a105019fc25e5d1d76080f4cb538a38a06e491d3dcbc484

See more details on using hashes here.

Supported by

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