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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501161731932516-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.dev202501161731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501161731932516-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.dev202501161731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501161731932516-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.dev202501161731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501161731932516-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.dev202501161731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 84d950c47acdc0712a8508ac9144382b3b32ad9cd9616e23a3ff7c09eaa9f2fe
MD5 c4ee7d69f26374091fa69e4114a1b707
BLAKE2b-256 8ed584876b309553ca60ac7d6eb77efc6b28876891a65758a0bc3d0607e2df52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bcde99089ea5283c8c42c9fc02db8482be0350d2cc7c718c7063e848940e56b9
MD5 cb8b4c7d004b44d6c5e878027790ec0d
BLAKE2b-256 327690752d719694738e2a373059f1c251239484fe55e00a65ae0bf2064a9897

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 55393c8a83c01e10abfab37c6f01ee2bfa213dd9ef10516640d3f054ab78b320
MD5 fd9e9586062be6bc09dd1ac5d7fe28a2
BLAKE2b-256 3556772fde8d3e68df33034499a051c28487591d76b0fcec494e8b57b6e54d85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0075c60bb99c6ed3dcb141f408b3faa4650bcc09b4d1bc873c8b3b1d717b301f
MD5 2a112b7c7502ea58cd7dc6ab0728a6bd
BLAKE2b-256 c3cb2a3a5473f568345dc8bf362bf5b879f586a48f92408a05e570170358bd7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b0407dd4a639ab87e0d2b2388dc085d1624f8fc06341e7fd8d9eca53a7eb0cc0
MD5 9a870d0850764b65000afbda5fed9f65
BLAKE2b-256 85b24e05589d0a1db9db9a508e18794d961d915e1ac7482ff6987a6d3e0bf509

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 23dadb6a9402769bb3035540919a1134d70ed4a4001da1ead97c015e2514b66d
MD5 36f69885e202c5cd0727f146d5aabed6
BLAKE2b-256 e7009cd35ab34bc305adb269737fca333a27cbc228c073cf16f111b61d7fcdc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ad50794cd0a10b56952b8e0e58aa5f1a066a8d12a1111aa3e2da9ed6c0bd23e1
MD5 0ee1eef356cf83b2425198d65d7ae6b3
BLAKE2b-256 5593c741c2b01f0a385f455e470a44cd324bacc7ffcaba750b9909a1b4630e98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 031a4bbff15223d4e6a9a2f244e940267271dbba39ce9c6f21a637c754f3fce6
MD5 8bc0ca077599b574c8fc3b8de17568ef
BLAKE2b-256 27dd07c41c2488020c7fc21531ed71a7b7315fd6dd2ca046bf49143242274fe4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a49ededd4f96dfa1827595a6371c3540ec55dc261882c0d354646029a1110f1f
MD5 8dca71b924e756e7c2e9ab520d50a32a
BLAKE2b-256 eebb71926df5439edbf45180b34a173fb5a9aa6c40156891bf7163737ca09543

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 822e94f39eef91a40c5368bdd251f0dd877a4e175ccafb5af3f58d26857541b5
MD5 581dfaae2f4a595e6bacc999df96c2de
BLAKE2b-256 c95157eb9a7e0420a4efcd03f0648a7a7e0f7f2d77c403df9a8faf130406c231

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 431cc0407e71bcb543b66b1eca26668a24c56a619f5736c8fabc491de042bd49
MD5 1022e0222c3447e420f9c5dc80fefb5f
BLAKE2b-256 54ce5e638a94936d8a6def22d3c5f52e3f9848610d92da37262c2f8ae0d2e002

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d94271ec88f96d10b6e16c182264dc4d4fab1b08ab8a045e3705f626c5c2a69
MD5 8b57677c66c21af3d75ad5ce1e503db7
BLAKE2b-256 3263af758b0c13c1ba7b6f080edb42b11fb464e53db02e9f50a210f6e48a2b38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1bcd7219345275ad321094dc681fe2eb684e919b6e09cac2f6eff157ab9d437e
MD5 e46d24bb9708b633dbd75da9b26431b4
BLAKE2b-256 649ba36fe7c07e87d30c8b8f0847b92bc2cc605902a3bf2e14c9b5ca1894a2f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fb50da6a5ecdd78ebe8d96d12ae395b2b881c44049bac42758f9a198df52c756
MD5 bc457f7f75d0b5852a612af9eba5050f
BLAKE2b-256 1406bc55a051160e32b74d156f2002093567b255e84541beabc4144af81a7564

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6abfdf797187865f5706b4fa8d5ae5ccba50cffa1e94a63d34bdcc527dbe5dd6
MD5 00df31fc34531ba7f7513c12b4a52385
BLAKE2b-256 c17acfcacc96bce850118d205058c57ef58c2dbeb856f452ac27784720a573c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 48b7cfa6986ec8d7553cd1bc2aa28b0bfe33200f24700c064c7285c820a1af18
MD5 45d95173545f2351f7469440501992e5
BLAKE2b-256 67f8f181723d357272daba5620f7139dd7992d00237ccf22319610622c461ca1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7919e4ae5e7dae8e59de74afd62bbefbae566c6d42f541890a2852573bb3deac
MD5 c52c986282969aeb7f7d4148faca6934
BLAKE2b-256 16cda8f60b1f0691734d29579599fa32fad29dcddc75cbc08e6931adbe474534

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 763dfd5db4340a00af914dd06c82867580c7890ac962caca85202429718fb44d
MD5 8cf9b129e8838fe53676831b8de38cbe
BLAKE2b-256 c0997f27e48800fb547dc73d0666a965886600b13cab1c9ed6e6133ae6ee1e8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cce17fb5d481d16f82a7768b665a894d66367a714e6f1fc977489a1b5a5d28de
MD5 cd40f2ef7a64566ac852d89be5d2d883
BLAKE2b-256 d684a0b90f5a50f08c468494497a3e9ef108234b423ea35725e2b8adb270af25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501161731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ea262a022222be9589183ccebbec0c3068fa39e8ee1adc4ad80dc860e8b124c8
MD5 afdaeb09141040ea5762d0061df2c191
BLAKE2b-256 5fd51f1266b783c039443a419d4ae760f227a2eac4f9dc654975e9dcc35ade98

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