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

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

pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 66146baeb60eb3eeb514395ed201adee8ffbf4a8e88ac7a044ee2681db3c4442
MD5 a5949a86ae3da31cb7925e962e9c3bc7
BLAKE2b-256 fb344e384b2ea51a08805e71d3241f59659758fcb34a5f614ba591356992f9dd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af4f86a3efe082d4650464a38487363670b29a2ee874e1bcad3e8fefbabbe21c
MD5 ff18138a28b6f6c2f3e81f4fc90a0fbe
BLAKE2b-256 4c7f7ae5a063fa01bfe16c5e0a64a863a03bd93413c84bd0c32eb6ae2eb6ef29

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d5321b60ad54d0d0e7645bbf0a3bcc8596ae527fa62ae101b284dbbcacd5d85f
MD5 7b111812ae33ea4e3a1133548c5faf46
BLAKE2b-256 406d8ac44d41f98269639e2ab2087d346399c1ca1b9636d1dd7de86c22b8a108

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0e7d4eedd300b9326f0b601896d933908893ec548c98e21e6455966dc936f59e
MD5 d3391b49c21eb6d9dcdf86952ddc0b85
BLAKE2b-256 c9cf7b0ce1713ba00c943fc3bb2709461484748b1a4b8fb6fc9b8b60632ef2e9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f4f917c157e6721a2c023b5a7847f128e26f0ec8ddcf5b2d0b2b237798acbc93
MD5 6d97f9a4ed9df389917e8c6dd7cf0580
BLAKE2b-256 af06a192f1b9f65708b0948c4e85e101b84e9307a01dc97680a63ef60183c04d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2b560029974630561854147e42e602cbbaae73fb30e35311f1674f070cc45e4c
MD5 bb6218aea3d5bcf43c59a199fd1736f3
BLAKE2b-256 3a78b62079058b00aa29cc3cba9152021e6357a04dcb0170b5b47cd0fc14fa84

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 975250fd1ea3d5bda188a103516ba35370a55d35482588aa27967e763137f5a7
MD5 af3948b43222009f6dad707413d66bd5
BLAKE2b-256 d984343200f8b559c7e59ed1420ecfc1e87e8eab36404d02aa1ab231ab333aa5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 16bbc97c213742dbeb93e83fef01e3b739d3997fc1e38ada8d4443ab8a12a1dc
MD5 9c6a3efa0ac06657235580b2afbde5d7
BLAKE2b-256 14a7fb2a04518af3b953d5387245c4636a12403217cbd5f5d31a3f64c16ffda5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a0762542cc88c5ab4b251e7a946481e72cff7c3637a90c67a5ae29d1485baa0e
MD5 cd09f492a8587a9bd47a3374960e2ef1
BLAKE2b-256 01f63082a81aba2f7aebd465680f19a6892896f7ebc2f47b8f75206e892d02a6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2924a00d589c029ffa7ffed687bed978386cb542bc638a07d8149b45db9e5c8b
MD5 b506cfd079de1d54643ce3a2d4a4c307
BLAKE2b-256 266c217535f2e27ad92587cab8bac7cb01c80abdd7fc15c96f16581a3dfed73b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 500c2dd9301921c40136709598b7a4c37963f9efee5eb7c26c02e300e3af812b
MD5 0580f75c0ee6dd5ca9c04d7a2900b1fc
BLAKE2b-256 0711dd356ff3eb6028ca26480fec55ae4806e57ed74d3ac3ccdb55c5b8d73c44

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 852d67cbacc7cfcf9ec50890cd6266cffcd84cef0c0e1ae81a1a53a6163acc14
MD5 39005f1008e3a2cdf9a478498b9ba089
BLAKE2b-256 ebb8d5b89a416669b67ebf3c39253ceb95b974d66877f9aa7a99c5665c9116af

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 41a0788dccc2302438b33841c48e36527315722aa9dbafa7f3eb644bb63ec86a
MD5 e20abafd0aaa6630f0b69490583345e2
BLAKE2b-256 08d754e593eef4347ab3f84d09eec5c96c3bd2e62fc884f6de98b1501bcb5a6d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6fc72e440fa73516eb4a177d387549723511f4da98f8bb4b32d05894600dece2
MD5 af64ae9dfe82267f18d0808e46b646ab
BLAKE2b-256 9fd9ae998d2eb53768698c00d7b8d6e5c4efeb7569ff29a272dcc0d14217e6ca

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ecd97e230c90a12a8d49fa9754fd9a5c746a35fb7aed4706afe6ba38a3eee432
MD5 bb56fb24a0563f08d94006aab9a3710f
BLAKE2b-256 6043a01e955166c3df7929eea881091cd4ccb8ffe89be18a143a1bf4f44e35f2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 951b8a4534bf5196ad91b2c9a3eb514a9a435cf44f180b66fdc05233350d74fc
MD5 003b55d7ecfa8f015f68cef8c0bbf379
BLAKE2b-256 ac21e2cdb6c6ca19f9bc8ebc7df8f32347ca132eef20753e57ddc7f274b2678b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 808cd2b0b6c11ccdd713b1ec51eb0d3ed3aa5aa14b5d993ab75a07e9d31297d3
MD5 1f23e081d064260c19a139f65fb649c7
BLAKE2b-256 3a6bbdabb119f5b6f72a1b23cef6af006416241c95eeec17b4c78b6e76c34d49

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 36a146d15e76fa7f03afc9ad693fabf557cc80f98853f06a15741736afda2c92
MD5 6902de24281220da8e95e4ce6bd116d4
BLAKE2b-256 01576965da4675e0acab5d50289e88c41305b3da7623115ed9988cb7983e33e3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 171456e2b1ad5575bcddcefdbaf70e92c1a7d7e901b686c2e3de5f27013b9820
MD5 81711dfe93bb21d1d86478eb70606e08
BLAKE2b-256 dd66b9c29c19c567d7948eaab26ce58542aeebbfb199f6a175e00b80d9ed5b77

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501251731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1280abf38c5ef2a30eafe43096e837f1aad270056bc921893782cf1deeeefeb9
MD5 e30359d54937127740109ff590ac0e92
BLAKE2b-256 ee4c6e4d87bf50c1196806d2f242193f25044e59b9863734e2ad1738709746f2

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