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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9b8b4801caed070ce20575a83335a369047501baf2c681c46fbfcba6d7e40252
MD5 cdc62f54cdbab6ebc6a379adeb3a4a6a
BLAKE2b-256 c50e512f71a5177c3f56748a0b39a79247b44a920213b921b4a89ee6865166e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4acf001609b6d9de2dabf924e31002978f68039a790b1b4259e239bc8d2659ad
MD5 d227d777edd165f3c6fcf403f6b4c56e
BLAKE2b-256 9c27ee71e20c447b7443ed1f284e29e3b833e663de83dde38b1d605d2b67b1ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 286d58bab4e386fc0fd988f3dff852cfc8fe2b5c565c6d2597360b232a2af15c
MD5 35ae62f3088e07f603d060e5cd5375aa
BLAKE2b-256 6e07f66c8250f0b5147ece169a093abe509ad80e3aa74d772c287bbc3ee67b0e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b6e58656d6bbb06f07e8a59558d0ee7f013118a782f1a0e4a896aa49f13a980a
MD5 fc5836bf55b2906481bf335d41e09d37
BLAKE2b-256 b4b77d84893de107727ccde31aad55fdcb70ee6d9edb99ae52e73d7fd6cdead2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 aaba42396b521dc1d9651907243e52f0d55ee35613490adedbc634f7744e6f43
MD5 03e2f63edbd0ffae6b69bf2d4ab50cc9
BLAKE2b-256 af8daaf39876808564d0dedf8815648023614efededb27716a0c2413c6f99cd8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bab2d4a3f03f0820a1d0d18ad80e8034ef24537586a983ccb99534577642e1bd
MD5 c0e244e999431c0abe7dea84654be476
BLAKE2b-256 6aa0536211e37b007bdc7dd32d8c4b409c846e176180ef4ca99af7309d673a15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7e037e3b8536c0b521835fcc981c5b797ed37d67b82591bd0c1bd13206fcc299
MD5 89b4d01dd3641b331c95761141f70df7
BLAKE2b-256 ca1e0bbdce5392263e690eedba9f46ace859fe35da9bac2ab578328db64f3eae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 42360f13ec9d7496ddedbf49d5849916240f0fb448e9ea665abf2470b9e28426
MD5 f115bbdfcac75817a5297d178104a042
BLAKE2b-256 5adb60e464ae0c3ac2b39fd0bbca2e3c464b7e7345fab673ec0f37d11d13531f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 65b87f73a1a77e82652bf5478f65562c58a244b745ec8003e67711f09a6edf3e
MD5 c39fcf8d66923a64a9811c4ea99400f0
BLAKE2b-256 89c62de9cf05cc0c962868209f879f8a20a7d00e906be6bd003c83f6b9de9942

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9ed60780806f76f8dfa63d0eba16d8efdc20e0f044bf7d2293c9de0fdfc5fa7a
MD5 d599b9e7cc586b0814dc05ab306376c0
BLAKE2b-256 4fb4aa01695294e4e7f2e995d8714e83678a3c2bf0ad0ae4fb54c98e51050c47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 992ac7328925e5254e96cb3ec574140d683d8faa1720b774eacc5d770f5696d3
MD5 e2d8bc2f578b65eaed5b698524cf71b1
BLAKE2b-256 ebfe6677a1ea62e4e64d17885c336c65d6878a878c1d8455bdf6e41e8af5e9ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a472049b83b4a3c7423c1d221171167221474346207d7b991d124338288b6360
MD5 452715e874ec9747a1b7c92385cc04d9
BLAKE2b-256 c91470346deb22987742a2274fab40e00cd1d8a02e834772170a1bd0ec6068e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c26fd5dc9ed95267f7e6a57b08a93797a7e84b4331b82461209868ab0163c4a3
MD5 eca7e2919a9090853b7992a92514bc2c
BLAKE2b-256 ca068631c0d8248940a45e92c2ede3a52bce563a1cf60c7cc65de7e67eab0651

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 098385af64c42acee61b57d1bb83b6860e43137364045738f67d8bda175764d6
MD5 cf2093466f2442639bb921cc5cd491ce
BLAKE2b-256 72226233cb8eb3f7f2f7b0127aa9a85dadad848fc8563fb4568b8f1046cda91a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9d3461ae5b9a4a53783e6348bcbe2456fd863b604849afdc5b75d4995c943f1e
MD5 28f908aae0bf94ce0a4d8d31dcf04f4c
BLAKE2b-256 a3b076c5bfa24d435c4716a5cc4fd05810d72c336c7e58913319030e7c6d90d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4ea828ffafb92674fe60832e0914103779403c9be54753ec67704027a1825937
MD5 d85944ab147c45c03a17f99a7ba55658
BLAKE2b-256 dd823c0a5970c47b8387fec28019e128ebcb84fd9ee5bc1a674240691d7f4d3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cc7bb0c9168ef9812f3134c4459f310121dcc2ae057eefba6de6c36b9d4358b4
MD5 10ca3338b0721bb3cc1edbf23b9e9ebf
BLAKE2b-256 3149c1695d68a0cd4f4fe5e95e969e748470f0a78d855304f5c621ab3612aa8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 395c53eb3008bdf5791ef4e8ed40b4385fe0339042c1986d9dc44987bf5a83e1
MD5 096a12a362c613006e403e98d9d8cfd7
BLAKE2b-256 eebdcfc5a37786fe9ac35a2cdf94218c54d724c0096ffe2652ba27880b721758

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e4db9d61d8798a4cd19cb8444d1473ffd018cad070b4409dd4cc58823ab76a7
MD5 5c242f3ca92a88369f1f6903f481f501
BLAKE2b-256 18465e98400a582edb0c4e73bee5e17171ce457d941cea2fa8f9fdbbdf23038a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412021731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1e855fcb8bce88d69c0130239f5cad4f4d3cb453bd56ec2b4f7f4b7d0f39e889
MD5 fc6c7cde92d1957b751283a9b2db6b1c
BLAKE2b-256 4c0d743ac6ab77529bea49d012520ad999d69e35c05aa887b47ac98483c54505

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