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.9.dev202502031738433769-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502031738433769-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.9.dev202502031738433769-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502031738433769-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.9.dev202502031738433769-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502031738433769-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.9.dev202502031738433769-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502031738433769-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.9.dev202502031738433769-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1f08805adcc2acf72d7c96e858dfb14407247deae6dab673da847d4fc32445cf
MD5 eeb0bd3467f22ef751de1621dae1a346
BLAKE2b-256 222744458f922644ad5083912c9960829c332788de4bffdaa37c93f5ff1a3468

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2fc5f1bb06f75566235bc4f2f2cbffee66011ea764a26db13227eca4fa8022ec
MD5 1c804f44064326bad8fb4ab36616d07c
BLAKE2b-256 c88f2c72a633739b37734dcf03af367d11d46ca04c3e3cad2225be02e82ed050

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6e7b9075beb7b1f8dbfa43de237b7951e1709986137b00eab153e4a8907e7dad
MD5 750b07ab40b2a6ebcf6859836f72115e
BLAKE2b-256 a2fd67f90aa8df3aa03c8ad02422f333aa7e715fdf75915e64cc2a6ccb819720

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d89bfb5fb054d4cd12d150ece9df47690f679ea7f9805af2da1f284a7879cc5a
MD5 642f4415e4142ae2966f7adb84f1cd9f
BLAKE2b-256 3c43b9c4e930e1922ec4c9d48f5dbbc8a3267dceaa4ce1f667c8bfb6c39aa8c6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 1e96fb71c37b49886f6615cda996b32c1dc67a7c8a3e1c6ba1795755ee4e7372
MD5 4fbe514a9fd4c23e1c4570a97f13156c
BLAKE2b-256 cd0b1337390389071b738759287a869d1e834c509a6a3b2988c2d6c6f19d6bb5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d6ba2b61c2a482601301342b42d3620147dce61f0667cfd86d43d218ac007383
MD5 c95393dbfb9613d1fd818dea24a7d5b7
BLAKE2b-256 24d81b851415b6e5c30d4f94c1b36a3ced381a6af43802556b35edad9790a8fc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fcc69c347700c6198cdf7cd42ebf37e2d728972f91e50a220b8f1ec932ef6297
MD5 0dc0bdb478977acce317086b98427a5b
BLAKE2b-256 9c336c38a742af7166e5ad9a37aa41609a1f4d5a91f760d2b6810fe4c401aef6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 26aa1e32c0650de4b40567bc9210f13d95bad39a01362c572eaa136d8ab8a9f6
MD5 4ed00b15a2b2ad24f045be3abbfbfdae
BLAKE2b-256 58e5c0d80c8c8b0eb68fb7db0a8659ba05acd4a27b488f94ceec3f277a66c001

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86abb7a5a9d07da5fce57a8e15e058c161c1d2c07886028877d7f9bbbd118787
MD5 c21b8b7dacb91550dec8b8d25f7b7446
BLAKE2b-256 d381c5c8bec060a8d4ba3090af525872013d40745d49acfd9588cea1ee884a22

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f4b5f9ccc5d62a87acd54748ba5db76be7aef4c9aebd9f52e264d2612000f6e3
MD5 7100c305c8f5fbc1c488333166d377a5
BLAKE2b-256 cfc27c336c78d3d2f7a89b362d380cbf339cfe2e5f731e3b10e5bef78add8e38

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 17cd3fd2030805520d23634913671770f06c680e4a13ade64914a51fc1c43377
MD5 38c922a5d3e2f1d5725280909eeef7f5
BLAKE2b-256 0d0e35bba66972e4af64cfd83c95a28d1bf9eb6b733f671ceefd0b992c9cf10d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 37ebde443386f34e9d7fd1451af4cfc3f09302575ce80837678ee8af4584ce49
MD5 63609706ecc682bb92e1b7b3a559ea1c
BLAKE2b-256 a300b2f77b022afc0c2e61f9b074ddee52bc86f0205d63c5ccb47a1267650a8e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ad87d391ef691604098053324e27020aaccb03a72bc0dcc68b1dfcd981596d75
MD5 0bee98aedde4b88a5be868345efcf1ba
BLAKE2b-256 fe199f7c539c07d84c2a97e531d08ac74b2d979457c786e1b520fb19c0fbc556

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4be4858185c7f895c7a26a2e8eefbcb8c74e48c5c5ae8fbdd59f7530a0db17bc
MD5 a5b8331131a374bb40dceed852cb1463
BLAKE2b-256 699e7ec37b59547225b2a438b149ee826b6e918132dfa3bdeea05c96c4928050

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c235bf9b0a5ae8d78e999e9457f55e11ba5e6409c250d590d44b162a02685fab
MD5 7bf5f3426c4331448bd1191212a1a98d
BLAKE2b-256 54900fdbd6886c27d1b9982734e423a242f9ba0bfd25d9f24b2e6861418b7b77

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 13224ecb78f8dfd2c502f31f959ecc6a410ad0b294722ef26b8e40698a52026f
MD5 ff001778b7d2e861bbd1ce7e7e45cce2
BLAKE2b-256 48d4a75c4229b9f6b045c9963d4a2eb18061452dff4cee5671de4e9182cde727

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ad20a717c7c87f1d984026ae80eaa8cc6a0a6f009777c96337a62128ac3462a9
MD5 31cb26c51d60cd5f5d6fda983cb0334a
BLAKE2b-256 e50f0be472d32b40ce491a596f84ca900c4f661f191b86aa24fa01ba6eb70fe1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 157fb5fd57ffae83ab2ccf239e807567d97a597fd1fcc8a7e6a2d28d6515665d
MD5 2d170ecf50df718e7e917352225cc76f
BLAKE2b-256 756fb4a12776fc527f1fea39fafadd187534e1544f0a72a07c9cb6253c68be44

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b59c60c793c994a2a19485ef77ae85697ba240cdf2f25ebbcfc8d81de4357d6
MD5 10a8f8196cca6c404b022f9f28b18eda
BLAKE2b-256 20581b9eaed264ed499faef2ad15406920b7adbc635c95879b0933227619f8d8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502031738433769-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 44df47c2edaa3f857be152352cb4cc64cde9b3d6c570d61e75c7ef743013740a
MD5 aa465a63db28c2e5108d6ccec85505a6
BLAKE2b-256 3d89308404596b61f8f0a7e953343f263f8b09d7dbe1e1e3a501bcf34fb6aded

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