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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp313-cp313-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6c8e7efde3886caabc5485611a78d5a4eceda9655fd82ba498daacdd8f2cc58c
MD5 24f5652942eed0fe6f1b76c4e5b26145
BLAKE2b-256 e89574363360a5024e1ae7a94c16362042a61826eecc5ccdaefed9b34079b5fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c32ee0fa51a8a5ffa84bbf9a95bcebeccf34869ca0e224f0d61e7a95a7b3c4d6
MD5 ab872783501efa2507e0777c9598abf7
BLAKE2b-256 12fdfb36865c9fc2ce8f0b201724c40559d824601488fad08a494f21f9c780f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d3c75f65fb30eda5cf11722030b360b1e25d751684c7b0a057383e670971e619
MD5 649cb1d375cfa9a19efbdb8ec5c1fac2
BLAKE2b-256 14afb8c569d2e87d52ab10a1493c1c0b97871471b0219f1b3a88774022852781

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec3cb1d70a85106cc623a7e0f9f4fe2a3f2abeff6c116a1d27af3face52ec2e0
MD5 37d2209f836f00438b2a3c4310ae777f
BLAKE2b-256 1e68fc6832d31b64e085168f4b8f7812980ef64575680b9ad8d414f54024d29b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 279f5ff6d14030fc4bd4a585589a25bc7328df502e9e850af63408e1ebaa960d
MD5 69cf457a5ce0e1024dc671b0dd9a2af2
BLAKE2b-256 75f5b34ff4995d440d0582bf3b2f9d8f568dbbce79780e788b330b258020bfec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1f86d980a3fffcc5615ed636e4cc4fe55afc31469fb42fa1b96cc542627cecb2
MD5 ca27e1830deaf9f571cc57c14d0c069c
BLAKE2b-256 3d0435b85436f66961aaf6397af654f52d162ce80e3f988dfb2138abddf64ad2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3fe5d19f1ae06762dfc2b21332854ba7bf81dddbd0ba4a96e78d0eef79e07549
MD5 f3e0c65dd6275c0a26cf5dade0d3167d
BLAKE2b-256 b44280ddfafcdd68bd14a8cf20173a7d3c67860d4ec12e1effcb93e9f2633190

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c7354f8a9eea99b76ca50d71ee136bdbecd13125de36146ba00dcdee4f6e983c
MD5 ca3748be83b0fee1dd07c37a65543e49
BLAKE2b-256 7c45c1619b6bd39269ca8e8d5c5ecc9a7e02f379923087a5110c78c28534cc4f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 faf223bd54d070ef763d63013ae7a4101dcad89545b11850b3c1236566f68abc
MD5 2ea5a5ce87958dcd1e317f28844ac540
BLAKE2b-256 86ffef7c51bc182a43404d10fd84959685aea83a24bf94a2ca1e53f923d55b4b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ff0e3f7bd64c13dc576a50ae176ac4b35b3c4f2e4e7a15d369d09cb60b57f758
MD5 bfaee6bdb1fc0d9de02b191bbc095fa8
BLAKE2b-256 6e6db1b1d29eda30789255fb947f738161d44f1752b4f2443459c53e8b545dd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 eb77560a181b9621fcf8e830384e5a464e5d8d8fd4991fefd300ebee32c62dfb
MD5 a7539ec7466ffbeb858d157aeb0a3535
BLAKE2b-256 dd85f3005e94dff0114224337d6587ba0fb0b38dfd81d128d49a1c7f5c75342c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ed2985bb1a39b687972d804f50a10c9203f876b5c60128b20b8982a5dd3535e7
MD5 4d697b9a7a330fb82a1a685e614eded0
BLAKE2b-256 1f4a91aa3b718a6567d193c4d3ee8f77df7ea0eefff2b22ce6b3f9da7a47afaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ea27acbf7fb6a8f2bda69171b0c56a1ecc3ee39c656b5aa319f808edcc75f991
MD5 25616190bd56a2f0597f4557ccbb7a9b
BLAKE2b-256 a78c51b1ab08d0b7a66c29c559290560f885dcb30fa2dbd766722ddb86a968c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 301589f5ae06a15e9d62d32fa06b938e9d666b2ecd118b429dd142656380c1c1
MD5 6dc7280e11ea1567aafc5791dcb0aec6
BLAKE2b-256 b3d01effb3f064361dc04ee6d2d9eaedb8f96049b32cd8dd4a48a0b47318d4a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 06dd7c3f917e668622b23ec802e5fd29c5920453674d5725871b166cf1e5338e
MD5 6a1a34b4d0055f606fbaba16fc0ce763
BLAKE2b-256 b39ad73901bd9d7edd3eacb476f34b61d29659db94167cc89ca2375e31c091b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 53aab63280963adf05d06b09bdcac19bbd185a4d43f90bd4112a7ce9c95f21c7
MD5 c06ed0d385f85ab386d26449f6be55f3
BLAKE2b-256 f3af474a9f195d4e0b06820fe78b876bebc03f38f93f5b5243aae2e6db499416

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a7574d18990b69b35a38dea39b09af7fac41a6172204c0e7f3b928826134892a
MD5 e859d4a6a6347f6d14e638a6dc87ee9e
BLAKE2b-256 5f2e312ca608d8701431913a00269cf5ee3f0e45c02b148dd2072d26972ed2b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8e16a92b0cc445253847f2c9633a56bee2f9d0e8120ebeffa9d3c1057288ff36
MD5 25d536ad016badfe39779edf0a3cfeca
BLAKE2b-256 ca70e2afb4302f65b34f1ae03e28e63004f72627ec046d4bb0bc992594fcf645

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b289974be0d32fc6872e309cf2fa283e2298fe8939943dc1b8f5b347e1213d3
MD5 634160c79fc62cf6adb247c6cdd03496
BLAKE2b-256 046cbf424882917a1930e18e1e538e473738575772bde75c131b5898658d6487

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502101738433769-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0a2f32a231c36f4046ac818489023b75d91ce19cc13c6ff82aa43dbdc0756594
MD5 18f31064929e3d9798cced1d780d604e
BLAKE2b-256 798ec5d86bebe6216fda6537a6e28683d123a4baaed0cf2878c3afe715b0e285

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