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,2023 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_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b01f1498324c31c7611cfda54524531fcc8f60ff43263d7972eb70649c402c92
MD5 3f86b1f18815167fd195af16e8270c4a
BLAKE2b-256 46e0011b7e345b9415179c545b70d2e60e15876042a4f541d25a2826412edef1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 456aaf673cd81690e9931da1a58eb9b03b7561904add6ab3291ae909dac26463
MD5 a2ecf4c85dbe752557d5f62ed75092a0
BLAKE2b-256 11bc8a3278df7f4e6a60e6615a8a0817673419447ee058a3eb7f2840c74e80d7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ef2dbb961033d69134ff69ff724fc00269df3f3eba11de70a867bf27cf0ae45e
MD5 be30070a861ea938b94bd584e9c622f0
BLAKE2b-256 37ec5191718c715321c269b899bd8dd08797830712b93d14625470aa48c8791c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 abd5b5e228df0acbd5c54e3a695f294c92124b8d141c34729fb2b8e8b5737e12
MD5 5cc6c70682f99c12b0fe457a199f47f8
BLAKE2b-256 f2301b59d6a9ac2156b65e835807c97ba52a3aa88d38aa959c53f7ca70f08467

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d84439c55289e77028243873577f9ae27692cbd7560f0f32ded8f24d62ab0669
MD5 c9c151dd1390c566446a9c2e4b640c96
BLAKE2b-256 a25cb6f39fd52618f6e5378e118add567d8a5ef1d16ea4f243b9881c2bd4c111

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c114e27b0689917b3067f3249d9b8fef075c0c2c01bef601d489bda57a402a92
MD5 2e32612a08b4a5afda06015d88561f7d
BLAKE2b-256 1b4b870424aa71a26e81dc69305dcfc3e57846a16cca617d8e952c5fffcf0bc6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1647372e0768b0ebfc50498306a6dbfa695c638c400455eca9f468f5aafc6022
MD5 baaec02bdaedfe474f0a3efac7543fee
BLAKE2b-256 71851b773e4a6c55cf0f15bdb5b298acfe7cb4cff1ea9a8404826f0ca3b1bc99

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 544edf55b4f86e6a8708fbe7ce7c0de134408b71b70645f7da3265b15db4dc11
MD5 ba021de07cc55476e206c6deb53b42f9
BLAKE2b-256 1bca0662a9b92aac6529e90599590cee60a5294394a1f9bc9560fccdd71847f3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cfa78d7a0e8136dfc1f7d9af7d43d822ac5772a105a205660e7c71dec52d67c7
MD5 feeb4b86dcd691c493d535e99ada45e0
BLAKE2b-256 db402f1f98daa9c84d7062f6dda44b6847d7d6edb12664144c98495ea85ad668

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 53fc45ff643ab879f62769619a5a9850a31ca1e89db8b79c195f0eadbd3f7e10
MD5 ec211a26605b2be8c55a4e338398edd7
BLAKE2b-256 5b255a81b4c9a62ee4a3edc8622fb30b46e15ad100f47f1432e33deeeed52ad4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9febd330655b5ce4e89152de5d38d922881452ac983f2d94bbec7dacb5f46aab
MD5 a0d6fe374011dd11c5792fa3e62ed826
BLAKE2b-256 09f2f52f9c93cc8d80095d81461291b2c44b1acf1aa50dedbb541c68c9dc866a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b1772f591ff1306daa211c00b2772d481dd5f8db7600770f2b3b4f2552ee263
MD5 2d010eca3d69c5b76419ee584cf7d2c7
BLAKE2b-256 97a9f75e991b472f93cb240e0ec5f2286370dfc2c19e2431559d0621d6a35f84

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 933450c221f37adf67ffdb8d54e4a24d6874dd17951d5cdb8e048966a44041ef
MD5 53ed3d4397fc554233b584ba7404fc6b
BLAKE2b-256 ba932b520ec6825fed3eed1f48ed0d93667784c09bb0eeae3be3f3e8fe0e3bbd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 692f36821492dafdad144003b1e1b342960eda82862cfa2249d31d85b93a5acc
MD5 74a54329c24ebefa4b335726a6c64c7d
BLAKE2b-256 7eb57e8da4714592892801d74729bdf3cd4515852aa8c11c17c7f3ccc5c08386

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aba5783d7dcdc16530e3c567c17819e937d5c5a0b27244d50bec6d0a1b2e136c
MD5 0810c16897cce91712c37eeb1d3bfd1f
BLAKE2b-256 cb18f7515b3b52b134abe8c3eff5df367a5a9e336f3d211bed334523a33df20d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9583687056c3028d5b70966a494d80cd0226057241fb8f4cc54b3b542d22a146
MD5 617c7936a144f1d25d2d87f1521ec0ce
BLAKE2b-256 f3ab4ffb7342955b281cdc663fb36ae157759800daf558db3491743ad3566de5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e4a33ff0548a14613f889db08e36acf84fb36046171bae45be0a40900d3d14dc
MD5 beadc5fa886e9a6f0ba2cecea572c984
BLAKE2b-256 f2d4214958ca078539de8203e6a4a27d14f01252fa8633994fc7de4146bf3cbf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7425ea47180cc0a4b43696093e8293056aefee50a858fc1eb157f122e4876a79
MD5 9bfbf78c2204528397a4ab94b4b301d2
BLAKE2b-256 928ceeada4f7f28d5c0904dc0033450f80ee8b3300bdc7d6b382cfb6b9e26f4b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6aaad53158daf7aa62ea27c14dfc8ffedba9f444e6de70ab287b9ee3b945e03e
MD5 2add31d8451a9707bfd746b1439d6abc
BLAKE2b-256 b6b55a8f41c86c9214fe572e25659d7a7e5c55d6000037ab727518fda6226dc7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 de5e434f8973ce720c775cacd256cb3b441e47d79235e1c5070d1699c24d231b
MD5 c3facf1921f9256398d3115f8f4ff3ec
BLAKE2b-256 5d343ee52900651c079c238606f42d7813aa5563386eb00e1566a3d00cd6cbbb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 bd32979412f0d3e9e18d68b2d2bd66432e97b27b70859e7d7dc98bff22050989
MD5 ff1294b2df5fd4b5963ebf562a81fd68
BLAKE2b-256 6e4439a8c9803990bb97a763b1b5c8b1e409bc8e587acc0ea14fe4a7b50c5630

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 578bfdf0670a9ba4d7eb65408b118b94edee090408563c60d8eb925128272318
MD5 aa7de28be002ceaddbd4251c252ee4de
BLAKE2b-256 dce5bc5f19c0336b96030e085e640ce9190c8e4d1f52f6e1f822bea257e2777a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 51fbe9dec7af61f2e2cdb32ffa9eae1b5ea25bef0d8b1e7189ab3cbe8d4bd748
MD5 178cce79496713605cb0c2bce8aad0dc
BLAKE2b-256 5ab6e8fcd5a25812ddc2dab3130ec7659801b7709cc0437b5c8cebeedac2023e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26a1ade936918cd41a4914efc5445941c4095e92211d9626141001c929d9bcce
MD5 6cdb62eaf42f81a6350715156f86b50f
BLAKE2b-256 a5b7440dd7fa14b682434187f59a8c7278a648646f8eec3e85deb5de937efe1b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403101709747362-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 407bb79c13ca80730a7aded983377844715e8ba6ece98266c89e804e12cd4a12
MD5 bf9eb0834b428e9011d248d121f86782
BLAKE2b-256 59acc6952c6e25b9479aa9ddd1ae135f469e49213762446ad530902ea583c296

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