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.15.0.9.dev202407271721169663-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 22723e9759476c0494d9cf6ef271e535953e5c600ca2dd08c66e2e48b963650a
MD5 a1db10362a47b44809a76fa42aeb530d
BLAKE2b-256 168a9ab7b9c9a8ffaf725fd20450ec0bed0f64b3bdf25ee24309c61055be3368

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9917c4471a1d0035e7edb60e016e38322a44a6a28c3002a0be3339e5550e6233
MD5 e4a69988f90baf4051d8ba680dad3bae
BLAKE2b-256 28cc1a272e1b1b01e43e74181a4b9aa3d73fa1e5519b8b9adeef870d07f94c35

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c97ab42041db9f647a3f1d66a81d6d1b0a04115f1d1666b283911789cce9a587
MD5 6ef4357603fd9033ef55021f0f1c7ec6
BLAKE2b-256 37cf960de49615a5ef084a63ff907b833713b48c2b0dbbd8f065677c71c735be

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f46c2cb3ea981201b0e83e2710b13b70f172e3a838bfd0506760b4aaa749decc
MD5 5823e0387afb2411f7899437738ac9d4
BLAKE2b-256 f84f97b1fff766ee11c994b23c984981c9f4e048b3a1b25a1bba677550d27ce3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0af4cc0a37647c6852abef50e58bdb5ca330379aca29351b3c8a55e4df75ab85
MD5 bcfd03ef498e70b66096642d7e8b4029
BLAKE2b-256 1514896cd510bffeeba731b2066f2fb7c9256396118cd5fd7b712cc57a4df5d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 93c0c3400ada42de1f0198894b878228e7f13e705d165456efbc5deedbdaaae8
MD5 0ab5883ea112b169b2dbd92315a3a8b4
BLAKE2b-256 a1ee76c8ae31cd8b66ae7af82a3d06b14d34da936570720b808f00c9b3d96130

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25826848f66cd8114397434bf764defb75132690295835288fcdfb14b2d5e171
MD5 36f9fe2929bdecbe3c58ad231cc92091
BLAKE2b-256 2ca6c01944ccfa388f0829589692a2250a4e6bc4021d2f9fc4bac657c858e8e1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ea786fdeb656e95ca3813d9f323d88b6e6811e1a492c5afd6097bd561cc680bf
MD5 9482fbaf833704147e32ebeb49ac3f36
BLAKE2b-256 b272d9893256bcd07731eefa78903e04e0c76e36c219f6ddba539634b45b6257

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 06eef4a292aaef1a4b21f6fa1c3b95ac9c566541d762f095a5deba4403c89fc5
MD5 36953f06a41477be7735d266bc430a85
BLAKE2b-256 bccd0738a4f4bde357ba6c3666094b970c559557acf9c77996a2e8f12a94dc8f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1b3f1bb4d7aed26d2564807784a1dfef93bfc0d553c6938e15a5970d6250f4d1
MD5 f723f7f3dac07d68cf90fd1ee698d989
BLAKE2b-256 67974104cf964dfbe0738e9d8335a2df02a5cb2c9b864a2aa7d1a44e55948eb4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c8b438a09282fc7fd10cacf4d7de208d1df2501f88077af06d12c82dd77a501f
MD5 1235c6c1e47bc2d35bbb826841050663
BLAKE2b-256 219989a20274cbc9e47bcfe381f58ed47392c4993160252cfb45d84b1ec750a4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d391b7b2dc55a2bc01e4b2ae0e3ac74f5ad0680f1b3fe2c28e17dc22c25a1c49
MD5 42380a537b16693ff6858f44d0d5ddf9
BLAKE2b-256 3fd1290a15d06c049353bf1dd0df9030949884ce88caea1351cf22067d360b3f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a89a72f30563bc387e5ad205847a2ac76ffd1b2feec11238d6425e4079dabe00
MD5 d5cef57e9552baca3d8059268e509186
BLAKE2b-256 abfa73aa43a331e60a8913bdb6b7bf9bf2717675049ac236e4f660324bbd59ad

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e944420ad4af8fb7273c04c1571a096f1314cf92c087011407156fe451e9757
MD5 a9dd652f91151323035081375437ebf2
BLAKE2b-256 376c6187e5b5fd9591e7ceea69dd2d7d29caf3904ece64ebcafb706f6253fff5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 556334bccb8fa54c2f3bd3d39d89fad07c9a957bdbbda1a0968f0767bacd79e5
MD5 d70441b09999850fac6d4b1ac3b21da6
BLAKE2b-256 d708d6624dd42416c882c4d4118780257669e6c74327cabda2a4e9a15e03af38

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 838f90ba6e7e3b7e6cfb0f66a9fe043981ffc22e027f0d264eb1fd8fd714287f
MD5 fa02f0df2f5d35edbca947e9568ba687
BLAKE2b-256 a17561cd072a3d2a2f9ee26e88f759d121627f0d568c1d6f703c7f8e178f4f2a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2b0f29b4e51f6a8302fd4065376566430cb14ebc4a0a6a587b60515de49d770
MD5 875adce4c1cb3a37ee39803c54ea790e
BLAKE2b-256 c8d797a861416003429daf617fe642967c4a2d23a7375e6df4e2324580053c8d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b04c625a8e139106cc7c1aa7f4f7fa0c541264e4668878fe9f14f9189ce69abd
MD5 7101d8601ca8698bd2841ca796aabcfe
BLAKE2b-256 09d414bc63f609dad6cd4da1abfdb35de2548e48cda66f788743b355bff9e7e7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db89d234d391e9912bf39519a2f4e315ca4422b981a565688fc2f24355864276
MD5 6b321ff4002ff09a7b9f183b3bb898f3
BLAKE2b-256 9e8a6c4cb33df805efe2bcef1a78f7d004e969d360c6a20cfc6d2994b0c3c9cf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407271721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 01159584beb72a3af9e9e6ea05b3ea74e784988bfe289fa7315c19442aec3a37
MD5 c9205ef4d6d380fb4f9a2a36f8b080b4
BLAKE2b-256 3d8f9cde865e23c64e91ecf3dc43d09ed99a59505b36d4ce6e778d5d03b76038

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