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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.9.dev202411181731879764-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.1.9.dev202411181731879764-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.9.dev202411181731879764-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.1.9.dev202411181731879764-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.9.dev202411181731879764-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.1.9.dev202411181731879764-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.9.dev202411181731879764-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.1.9.dev202411181731879764-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c8843ff463b874a292c19d1ee46c6c334a755b157ea06e29a997bf62b67965be
MD5 e7b812df9e5307cbaab45ffe62ecca47
BLAKE2b-256 c580c85d4fdbc11b5604cc6c1412af02424158c81d78ce0e6a4db59acbaeabd2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f2101d3537bb41a6e42c43631e5f6bace2eda082056d9f5351f101edb1259162
MD5 c52f5d085f9b8a2bec7ef8591c8ba2f7
BLAKE2b-256 22a4a6ab12e1b8ef97fe7002d28d11c24e46babdddc9f72ec4aa773fee3a6c22

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 88c432081121b3733b3afb85fa5fc987712213a717c03976354262a63385056e
MD5 83ba2546b2cdfe3059132d4fa31fb3ee
BLAKE2b-256 810ea08109fc65efb56084a7005795a3b54c62056bce12a79954a56eea603137

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79499f422acd3d5d829d10aa95b6242b05d072c710bba8477509af4357180364
MD5 fb916176cd5f6e464352a1df799d752c
BLAKE2b-256 3e88145cf98c4ca8baab761d2c401df191c887382b155494d00631e850a3452d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4beb4fdb968a819400c9a2de1010d070186c7b86c8922b31c9d8a358cbf5dae7
MD5 d4cc08f6529b2a1448f6bb00602254ec
BLAKE2b-256 feb4a8269af18c0cc7f32b6d1bf2f46ef151786db4443801da12867c2c22a13a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 741fc279b632881554c36c19c71702fa39aa6b3d2f62aa95b5bc4296bc35bb29
MD5 22b3e6461418329c9a9aff879e1944a6
BLAKE2b-256 278b82fab7cf35360ba9287a05a66c15162f24e62a1765b496ef5a85303d294c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12c28265561c7251273edd7e847502db2383f89c62070ecd1e8c0531e3d36a0c
MD5 ae27155e8a13cb6dc900d1f5c71db5a2
BLAKE2b-256 7102be70a262a4e01210604c32a063d29acb5bb8633dc1cf3f41d9665a34c857

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cb4f32cf05ab12759f5a017e2b68048811e74ce39c6942be8dbacac28f1ced0f
MD5 5c37f19b5524cd876e9a5bd704bfd741
BLAKE2b-256 1ed41e065fc7882890f8ef93d5e5cbabebca44cf13677f2ecdcc7212642303cb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3cc459c65f0153b8cd53cb3c36446049e090bd61b4fa9b9a82848515e1d82f6d
MD5 9264b3b650b14a5fa733166b933e29c5
BLAKE2b-256 d0131285e4649c01b9c70d5e02cf20010a080ce118b4371db7a34e0dbcc4995b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 71c1ac5f24570a718d6566bce0f14d904b5b34f5d44426864bc1cbab45ab7479
MD5 45e0768ae2d96ecba059b0cf4a3b8e02
BLAKE2b-256 699848482b16c1f6352cc6c8258016e56e4a303ed245b70578be9d1c375ae94d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d620d41b3129629167af30ab40bb06e3df35289bb5e13c064ab1580bdf39c4b1
MD5 3fead1d85989a10c98fdee947c9f95de
BLAKE2b-256 156859e63de2340dbc697188e04545834d4ef197f01a9507471836c07d65c153

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f935e9c4e7a5a823d09fc03fe7e86828cffdada3f5a80fe5d2a15b01ae32a654
MD5 72d9aa7b74e84899631d83f172ae4a3f
BLAKE2b-256 1600435eaa7ab265e9dfef229a6603c6f4a3532eee3316b2baa39a171f0dcd42

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 91ab61eaff20ff6204d9b62da10134ec1301f48233968881c93291c5119e0318
MD5 5cd26e1f765f776f6642c3bf51ed98ec
BLAKE2b-256 4d9d281f96db7412fe1abac942cfaff4ff22fec639d817f5a5a67189b35fe5cb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70125a8b02ef88c3a78326800c3ff6eb746eecf5b4e7c903a1ecda3091a90fd3
MD5 855a70d3c621aff17699b40c8a9e050a
BLAKE2b-256 b7430510af66347b4a3d3ba8663bfb538838bc83f1aca530d9a2002ad6b667c6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 780871219ada8f0b84bd1abf00c5975334ccec339e5e0fba28334ab26b942014
MD5 d6d13eca6b8a4cf89ca070a60431c204
BLAKE2b-256 86db80d3958e9503ed0e5ead192b6f669c0bbc34e43b1a44588d16e332f74c09

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 05b297ea471cf00c04c6e29c8699afab08ed831e2f9c8590da8e5c4d1799a37f
MD5 d8d66ad21d2c754ec9c32242f7fa738c
BLAKE2b-256 f85e13bee59c8762a290a90953260568be6a3efaf4df89187c4f5e016a4ddf0b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 738ad5e3bbeba5739f17972ff73dc20f7678a1e431095325b8162d9b6d136710
MD5 0c7808f3d725c1578c36719aa4ccf591
BLAKE2b-256 f28a6dc02335a2074f9c8f1f932286b16776b2289dbc710642682746ebafc20f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 069fc94d51b0516aa54d57ed25a384e0c7848bab78b001193cfdcd82aac1c431
MD5 bddf1bffc8a39af1b695150ab481f28e
BLAKE2b-256 21dec7c69c88be80ebcb82447c6ae0e700e71bb4d043ef80802cea3fb967778b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 028a2780a755f594f217298e17e7166aafbdbd6c9cee4673bb6434f34b4a127e
MD5 b76a8ed6965b98815df3e22cde847874
BLAKE2b-256 66941aad3ce88e0d2b87d940bbc694df9deb5655ba75770b55555cad78ddf4cb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.9.dev202411181731879764-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 eb1e2fbd5d66a8c05deee09ca1b26fcfb9dfae163f035b35643f37ac504d0075
MD5 235bbf0f3f365aff8f282ea690ef775d
BLAKE2b-256 c30b16542643b95ee5a8f86ad15738deef2243e014789f1516eb81cf1939fe0e

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