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

pyAgrum-1.17.2-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13 Windows x86-64

pyAgrum-1.17.2-cp313-cp313-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.13

pyAgrum-1.17.2-cp313-cp313-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.13

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

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum-1.17.2-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

pyAgrum-1.17.2-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum-1.17.2-cp312-cp312-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.12

pyAgrum-1.17.2-cp312-cp312-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.12

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum-1.17.2-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum-1.17.2-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum-1.17.2-cp311-cp311-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.11

pyAgrum-1.17.2-cp311-cp311-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.11

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum-1.17.2-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum-1.17.2-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum-1.17.2-cp310-cp310-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.10

pyAgrum-1.17.2-cp310-cp310-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.10

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum-1.17.2-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

Details for the file pyAgrum-1.17.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ed5e51e8411c84deb75f0225bf9fc9d07848d62d21ce9d29ef2362900d11896e
MD5 57d7c3400fc554f0157426d1777674d1
BLAKE2b-256 e5a0049a5f157d3400ab431ef97e6ba5847d7999df38492482c087d1611c7cb0

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d5d11f02fbca8766c78a4cc7f8bc2b852775d405ef23bd1f0ee6431b361946b2
MD5 4d717060c1157dab6559982d5d7c5f85
BLAKE2b-256 a5deeef6c71bf5e5b3ad458eb0efee952e122f3a7574b4f2fa7f8b8e430f5c23

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2695e7814b6c128f30322567ca3c9f6196ef0aad533e796140ee3ba660ea97df
MD5 c3ef5c2dd81e1540beaf7f5a0a5eafb2
BLAKE2b-256 89522613c1f00508c7eea973a179fccae0d727efd1fe49eacbb5cb04be1c1417

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2809b8d41fb1e82b1f7940316457e1a0b4a55b4b266ca5b2b4251cf437153a67
MD5 ad19c0dec52ff6180ecbbb51bf7e4f9d
BLAKE2b-256 c4e067bbc9c1176dd41c9722c83bc0428cd1119f63a0960f6b3d4d959b6bd4ef

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 024bd8a10c474a08a8e8f315f67f8811c91a05d0edc8f2a4c6e53e026f611a99
MD5 0271a8d13457bf1eeaff7cf2033d2c36
BLAKE2b-256 2978fdc0b45ae7b3a34f142a2932d600faf355f4a9ce0aac398a148cbf9cd3ce

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f68b9bb5596715ccb387ef74575222f60298277cf70b004bf0b990bc99176d9f
MD5 ee24a1ef83cf12de2126682b0022374c
BLAKE2b-256 ca661bf1a1b2cc029ab8925ab5583a985d887df2a3c0944b0ef5de60be059b21

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b01e750af1ce0d88ab8f81c82d1b4bb1ab57c624ad519b5488d9183f00bc4e3
MD5 e57c3f6ff8bf7b0def055078eec8e90f
BLAKE2b-256 e295be9717fdddfc08ac80c0fac86ef639cd70ccf92624888e174e809c6b3b71

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b89e59d0c4f19fdef6708e76d3cc671386ff23a7ce44f543bb71c89c68a2ca5d
MD5 4d5ec51520ee00f91fb83283fd0deee5
BLAKE2b-256 913db1cbd1f1fa62213e5156ab516725aca1455d12cdc35a5e89761895dda94b

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f67230771bdf0978144c63881a19c166804de9b6e8cbd0b90aa461f5602fa82c
MD5 414adf467fe12e1881f47144e67b67e7
BLAKE2b-256 ef7cec78bf181d130e953e8f99f990174e06dedef15b3281fdfbdcc4fc8d284d

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e9f3066e8e7e72b620fa95c740d23e340f10198da1950b7119b91e597b534cf4
MD5 5cb1e607669e193236cf185a09d3aea4
BLAKE2b-256 8d809359f9e1a57d6e8a068d0bb15d85f3c7d15b8c95a4a0bc5a2bdf7a77cf1e

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5735493d4071988e009df604ab314ab0949b09f1bece1b609d1f361c6ccdf3c5
MD5 a311ade7cc582a33c7ce95f17a685726
BLAKE2b-256 260ddc274cc315374b40089da3d23b53e1edb9a03442ab6d4f22cdf1205928dc

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 740491479a07fdfe11d01cf945f6abe8afa724d001f640f5b4777ee80f8b75b1
MD5 4aea30fc74cecc49a9b4bde2cb6ef1ad
BLAKE2b-256 37d685bb83304738ccd3691ab4a3f49c0209d1c1815f3f05a6ae9c003cb8d2a7

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 47f1b05f70385ec2a033155cb896498d6d146caa238e7ca99df50eaeb8aa084a
MD5 d264ec8540eb29bcf0ff37b00bd66ae7
BLAKE2b-256 cda99aef268e46eb2cb12126c01cf32075ca43fd437b7913b3634506f1c0d1ab

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db1ae83c50bd110adfc884b9bd3558669dca82803ae195a2afbd66d4d347b345
MD5 a3ad30eb0f74bd662a6a153d3b3a65fe
BLAKE2b-256 19eb7292d4641c15bb891ffd9ad9c8a164cb6902fc5acd64881c9c7a82a55f79

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c4a94835072a59bbd3ebc3c5e39f2b843b2af040e6c4846ddd0daeb10aab3870
MD5 33080b7e740e21e65cddf87caf6556bf
BLAKE2b-256 f804193344130373684ea76b912d50c40c78ee6355542dffee8596e23c9349fb

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d84aa4439522908127deaff8e3eb953f6a396e607dd46dd81267673bf25ed30d
MD5 4677cc72c08722a511ad72c8b8a847a4
BLAKE2b-256 99d70c36263ee31a1e7b8b2ee174cf9b98a0b388eb7a0ebb1926562304ff95be

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 547f8e7a16547db46cbe2558f14480bc4e5369426ccb5a3cbc5ad9a1b8a0ef54
MD5 37c3f0a28bf9386bf6903ace259c351b
BLAKE2b-256 6bc7ecbf130f15e8868c4ba7dce39aa48478373acc90f95d99a6d9c704f1437a

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dacf65c9a34733553aa96477d9c9876b8db45e30e39d9d3e59e3d11f50bd39a3
MD5 d5342b70cf569d8daff7a7933ed7e51a
BLAKE2b-256 1089a89c18abb24c849f85cf099f92278513ea302a948d7e515a05e34862e854

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7164d295993e78e42dd761e51a4f9afb54caafd686ef551171aecdfc33148809
MD5 129bde4a45cdfb6362bde95115b001c2
BLAKE2b-256 bd1fc3c374ef0b5663eabb351190066a7d82e45965ee9060057d515dabe0d063

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4a2ca10ed4a92ead5526541bfbecf85c7dc46d74751bf74cfe775cb3ef059b75
MD5 3dce51fb741894e3d290feae32d8cb71
BLAKE2b-256 340ae0fb15f417770ec734c8c258f2cb0c2353962158de0425375469d0cc7800

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page