Skip to main content

Bayesian networks and other Probabilistic Graphical Models.

Project description

pyAgrum

pyAgrum is a scientific C++ and Python library dedicated to Bayesian Networks and other Probabilistic Graphical Models. It provides a high-level interface to the part of aGrUM allowing to create, model, learn, use, calculate with and embed Bayesian Networks and other graphical models. Some specific (python and C++) codes are added in order to simplify and extend the aGrUM API.

Example

import pyAgrum as gum

# Creating BayesNet with 4 variables
bn=gum.BayesNet('WaterSprinkler')
print(bn)

# Adding nodes the long way
c=bn.add(gum.LabelizedVariable('c','cloudy ?',["Yes","No"]))
print(c)

# Adding nodes the short way
s, r, w = [ bn.add(name, 2) for name in "srw" ]
print (s,r,w)
print (bn)

# Addings arcs c -> s, c -> r, s -> w, r -> w
bn.addArc(c,s)
for link in [(c,r),(s,w),(r,w)]:
bn.addArc(*link)
print(bn)

# or, equivalenlty, creating the BN with 4 variables, and the arcs in one line
bn=gum.fastBN("w<-r<-c{Yes|No}->s->w")

# Filling CPTs
bn.cpt("c").fillWith([0.5,0.5])
bn.cpt("s")[0,:]=0.5 # equivalent to [0.5,0.5]
bn.cpt("s")[{"c":1}]=[0.9,0.1]
bn.cpt("w")[0,0,:] = [1, 0] # r=0,s=0
bn.cpt("w")[0,1,:] = [0.1, 0.9] # r=0,s=1
bn.cpt("w")[{"r":1,"s":0}] = [0.1, 0.9] # r=1,s=0
bn.cpt("w")[1,1,:] = [0.01, 0.99] # r=1,s=1
bn.cpt("r")[{"c":0}]=[0.8,0.2]
bn.cpt("r")[{"c":1}]=[0.2,0.8]

# Saving BN as a BIF file
gum.saveBN(bn,"WaterSprinkler.bif")

# Loading BN from a BIF file
bn2=gum.loadBN("WaterSprinkler.bif")

# Inference
ie=gum.LazyPropagation(bn)
ie.makeInference()
print (ie.posterior("w"))

# Adding hard evidence
ie.setEvidence({"s": 1, "c": 0})
ie.makeInference()
print(ie.posterior("w"))

# Adding soft and hard evidence
ie.setEvidence({"s": [0.5, 1], "c": 0})
ie.makeInference()
print(ie.posterior("w"))

LICENSE

Copyright (C) 2005-2024 by Pierre-Henri WUILLEMIN et Christophe GONZALES {prenom.nom}_at_lip6.fr

The aGrUM/pyAgrum library and all its derivatives are distributed under the LGPL3 license, see https://www.gnu.org/licenses/lgpl-3.0.en.html.

Authors

  • Pierre-Henri Wuillemin

  • Christophe Gonzales

Maintainers

  • Lionel Torti

  • Gaspard Ducamp

Release history Release notifications | RSS feed

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dc26183b8a6298607267e63ff3e618675cf76c4815dd46fc15a3b900bc85046d
MD5 3833a765907626dff21b00980642a51c
BLAKE2b-256 04f2b9a5efe04b3fed3ace13f4d11d3e5bacdc87e0596b524b4b680d67c4a0cf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 40f67598393181b4c7edaf425ac434010a05e0b518ce4734b218304f53ef29a3
MD5 f6648a15b2cd9f94b91f4229434a1f05
BLAKE2b-256 b17b8bfbfb0a3e27e34551032b3e1556be45e8a020b1f5cb4bfe2f0e62465ea0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2bc767de4e9daa51dde67b02b69d3a7b1387839e4c831cc8dd90b97c35d927aa
MD5 21fee2ed66d8cbef6c93f5d07c77f869
BLAKE2b-256 0255ce07a4d632ce048fa444ecbe44716560f38f87954cc3ad50a2039e86c7b4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae9bbc16417a419ab708d6374245fb55ff389b49b9e8b724286daa47de922b59
MD5 71ce5a80f94f99878690595caaa1fb08
BLAKE2b-256 36028234296ab35e57fecb6d4f9a4724c7b1f443c42b7b809f5d6e887782ce0d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a2c11c0db27821d9d9fdb385d1ac8585bfd735ffd3331a077288bc1c1b5be284
MD5 805e62c6241d5a80f768342018a65e84
BLAKE2b-256 4cc5e8fec8e2455a26380baa32851242ea0bc5d788b93068fa062b26f5bb5683

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b9ec5a86ac9cf64cb28c229679c539636b89a00fc7c37a908b99f275f3be0e0f
MD5 383f4f6f974108037ffafe997ba0c90b
BLAKE2b-256 aba5e064c41bb7a6798b6e22da51175631c7d3a3cbe5fcab1d3d9e42024c1d13

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ea364415beaad248956397c4aa53d4e5aae56a87ff7eac2caeb6ef0f98ec4db
MD5 c39ee38508c6806609b0a2a081c75bfa
BLAKE2b-256 80813240a2059f54737a7df8ef8c38a4d586d9cf2b6bef09b50aa5bc37e82094

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 be557614e3e711205e369c8c4b46cd9152f37c814a3a7ad0272bca3ce28f457f
MD5 08fcd02cd0c80f3a8241cec68f88bc48
BLAKE2b-256 8996bcd70029ab1b8fc29207d11dd5fba4746ce06dd916ed3edce899a37d18a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e7bc1b9fe04139ad443b93e039bf50e4179c376122703305c3a72db25f0e8da
MD5 f3ccd0495da53e53b602bb3be68d2c76
BLAKE2b-256 1e5fc6a2e17fad82e563c9d84d94acd1aaed87a738c13d70a56dcbeb8686d536

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4a5de507a40de0a2f45b4fe7ee2e814646a26d6650d29c83043e9aafc0140d5f
MD5 4c335e1812f17fc8d56ca464f8ccb337
BLAKE2b-256 e7d6876f76a9b4faa3b37c09611121e6dbc3a43fb12b44ab07e868acc19ab058

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 51ccac86790008dc7b15121c1cfcf50d80cb292e0f286caec2d1310abc4262a2
MD5 6304b1a985a972bc7de5cfb63afa1a4b
BLAKE2b-256 f7607afb61888c88c7e3ecacfc0f67a4fb8136d281967461e0f529a6734b52e2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30361336e16bfb1c0821e845a81d8d544fc6e146e52734ede14b9bff3f064018
MD5 70d53ce5047ee0936afa960ddb5fdcb6
BLAKE2b-256 bdc431a85dafeec167aaeded3375d90fdfb26ed085d92f1c913b17f92b9c1a08

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 871c3afddc8aee6022cf0dea6a45f115c1f68fab2e480f7e4ec5c1d6a6e06dcf
MD5 47bc06de47be65391256bf963bc154d2
BLAKE2b-256 7ad66fd68de7eb26708977442ef7f5afe80eb8b3e5b0930271ac1664171f7838

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9314ed8676ecf85eb7d5fe675600db91e3e90e73c3f318aed41b79a076f6e35d
MD5 47de841eb167a8c5e5057aff3f285c7d
BLAKE2b-256 9108208414864baa76f4e86e5f2cacc60181a7daef9137a001af8339ef4070f7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ea04ae2abc5633c24ec6b2c1327af1414a1314469a51d617ba07e521d2f62b31
MD5 dcdaf031cb1c36822937775732a05e85
BLAKE2b-256 e921c2ba872a681066e9c5e10e53c232e2e9063ee6ffa44446b6290c873659d2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fa31422f3ef59faa6d51d3a27a4fafcb4c8be89b62c0e918fdda5fbbf7827d57
MD5 4184d2d8254e22d56ec5f6763f277bc1
BLAKE2b-256 bd575610369259ebc9b3f35cfe8aeb96b8089a61f46b97d0f9c3eb7f58eb591a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b8b43e19c9fd7ed8d6ec65551414ec8167b95621c1768a553273dc315ed4bfb4
MD5 bcc800039475316dffc2086226af36e0
BLAKE2b-256 e0926ba4eebce49a113796e1e8e4d66af4022b63ca18738e688415b589f3ebd9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bc6d85fd873b34bdd7b93f0c9d2f7c227e7a9297c2bd7f05971b2cb19a17c9e8
MD5 c9ccdf6c3e95d7c5f1c0ff69f0a1924b
BLAKE2b-256 9b58a8238b318facc242a29346625d45c939fa378cafe3eba788696cefb73821

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e7278034d91db9f6aa0165a1534e0770738ed8aa3bff7ec6250400de45b2358e
MD5 b19dac68e1ca4db98470f0442d67ba2d
BLAKE2b-256 27297b262c64efb162ce33b0f07ecd0bc9804e0214f564dd3a0669e5eb0877b1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409251723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cd794fbff8de85b21cb0bcdfbf7de9117c1ec7a80186c3ead68600ab5b201131
MD5 a7b07bffdf33a96a39b269d4493c5e11
BLAKE2b-256 b27b2b854624bf3ffad24761489b1612e3a3da7039053c190381efe61e695c90

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