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.11.0.9.dev202401301701813464-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 31b67bbc1cfe6de9f7d3d0bef04c635f00184a070bba02844db61939c0d4574b
MD5 97ab6f4f5e0a4f528db81fd8277e3aed
BLAKE2b-256 a219705fb4df9b4a9902105f9720e606349cb409bfe42f5fd504b72d01bbb65c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e26eb77ec4d65090877f6a10268fecc688f3a56202c976e4326439d4f380d819
MD5 99b2d05b5d2e99788764a8219dc6a200
BLAKE2b-256 a5413917a20f8626b8b3ee598ccb287179cd635bdf6f84a14e7c1a971ff52730

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d57a483272ca325745f45eb787174c1e6251088f711e9cedde18097273b4f146
MD5 58967808e67572889a659cafe4287eb5
BLAKE2b-256 105a9e09be3229f64739f49c579399bb1794dd0f71f7f3f60790c567ff69044c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6945dab3657e4b716be57689c919068f00e7384e6457617ac10f1c09d3850ea0
MD5 a6fbbb1652243646c87580d71a4c7158
BLAKE2b-256 8f56aed65fb401938af24ecf5b6e56757c204c0b66d5fbf28feaea260104611f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7975bc17c4bf66653f6948e2bbe2499ab07cf5a391d5ae893a5ac54dd445ad66
MD5 eb34fb7794656c9faf4179695e453418
BLAKE2b-256 875eed2a8eb95358fe7253de7302f481cffa42079e4fa5697ce2a70db99d1500

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 aa38d34fe533e44e4e9903e5db8ee097df5605c90ffc353c41b201441695d5a4
MD5 e7a151085bfa9bd0cfad645d04fc9899
BLAKE2b-256 7239c4f195843f00a895a5c22d2effc5ebdd2c575a89a6d817f8aa0dd3abc1d4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 316143757b1640a084631db14756b1df1d9dd8a0b144310e4136ebc625c67974
MD5 ade745ad6aea74ac2215e5ff3795f745
BLAKE2b-256 eb5dcbfede5783e3c83c6a1af1ea80857e503a94494fb81c7d32f771616f7340

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1f5a884ff9a7f28243ebe26bca43738c51a9e202fc8200fd9d9501f27cc8e564
MD5 87c446985257f97248d540a2576c7eb7
BLAKE2b-256 3b00b27af86d8106030d33415834cd09ef99cc64ddcd91ac220a36030d677478

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2c71296e5c7a46697cbe86edc09a8cd3e2f1f967d8f58b783c7b6b7816b5ac9a
MD5 fb85ff5006e1b0cf18acf363ab311784
BLAKE2b-256 e770f830b5fc6efa54427fa935a53f36f079ea890b8a0f899923cb0670566b9d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b37c60826bbda1452049537061cacf0b5d57e465d0a40ff0d17f34587448d784
MD5 cbd338183cef6dcc672cb17308fdfafa
BLAKE2b-256 304c16e362af8d5561c7711fe3560771d6744cc338a7c20021b882a94ec3f312

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d3b9f1d8ef75d859c40744ac31a782276a51ebeb5d2e94ed0bd22f2b9bb7920c
MD5 0892ea3e82a3a00f8472ae3fa66dbcf7
BLAKE2b-256 6b875903946ecf0ee92d87d1c65605c1edd1f14fa4048cbce8d0c1ea20f53663

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a173647c15c0c77fa5b09df9f055fb6c73aca45b70114193ee9ed05c530ef593
MD5 37def946afc4aeff44567512cce3f44d
BLAKE2b-256 2ce7261f5f0e47e6386dc0c7c347767416ab5e7f7276730f6a5e2a297107cd49

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8aecc513bd00c66bb114d66a32b5e29e9c6e60cbad27bf7f3f06b0b5b3ff68ce
MD5 32bed3776aae6f2dbb5fb00bf0afbfdb
BLAKE2b-256 c3f082daceabce575ec1e1881aabe0cdbb13b9a7a662d2288aea7be5776d9fe3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 116dba6c101e42b5cfef16f4f59691374442cd596b1f5564e9770c6e8e902be3
MD5 1b1af0ef1921ab2958c3939e6d37a83f
BLAKE2b-256 54aa0ba55cda90769bc2ae192e7bbb91f0f88de47e5470591a0ae1070345577a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8ecead795db8441fb435d531acd57aa768f5a61b7f1c6037b249625618c8d415
MD5 203ca52aaaabe16d17a63c9c3515999b
BLAKE2b-256 bd84f4515e5263a78087548584f73b028e806e3e7973dc1a46197feb6d011911

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 725d995c8029e7dff2035fd7121a40d5230169175a4e69425708d7d4766cc089
MD5 566be1b3ea9512ce0e24ee66d06a21cd
BLAKE2b-256 64a6b0de6f68aa9bcb2c0442e7c47f855fc7b7cbb16aee70f6ec186f14d5c54b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2c1dc685ac3c3d064652e2700e7ef19dbcf2a0e05d286246d669df49397a104f
MD5 1a15ba030d38d51e998ab2ba13f58e94
BLAKE2b-256 90d73e13ef43f364ad1b7515e0534bd89d44073fa392bb4d36898926c5fb00a9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fbba1b5ab420a1fe2510cf1bbff01fb070b378681b903b9a63ff41adf0570ebf
MD5 0d55059d6ebb9a99fef2cda3eb51d3ac
BLAKE2b-256 fcbae2d8d0e3cf40ee60c33a74d1384a31f151e7c877577844b5dfc6b1f1790e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 abb57f57833f178305478aa200fef5ba9a1a22e8e1b5d180f7e0055a426bdb0c
MD5 b638a472a3b21a09ed4506f4fde6191b
BLAKE2b-256 9598a2b7ec3637f4354ee5ad04fc4951e72917b6ecedc41c8c3ee04b17b56afc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 be54c04e3142913c65da6d708712845a2ed30cf6221c691172f4cfd10c4ff114
MD5 5b40d738ee7eb1a1c93a7dc9512543c9
BLAKE2b-256 abf480a40d1c9143da642cbabfcbca79f3bd2d60f0478d9452d66f58ea0727bc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4045e19005f1372f8303ca61785dc7e85b747cd3b9dc03b752c8b732666811f9
MD5 06a01fe3c5e18d0e3dbc00b5112fb14d
BLAKE2b-256 c09c33a2a41ce8b8c8f70f8db3d94017ec8f81d64803ac98f34d290aed3b42bc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 413979beb49fd1ca08619beaf426c67d58fe3bb543c6be0dd363275d976627a2
MD5 b37be0ceee4ad69b8e151f0e61918345
BLAKE2b-256 7bb064a6f1dc5416fbde2f8134a17f2010d4e97b137de0bf53c8a93267df1f3b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bac189f731ec977bfecc231a36d0002d0adb59e1d705d36086eb9dcf1f6375b8
MD5 069484456589318321fb08d2341f07fe
BLAKE2b-256 3b7d0cd93798b288ac343e5772ee4c862b242f6e77e7e3be902285991ce13625

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 37884ab9563d6d39ae1131825382260f18fd76383e80495874332b3be5b63286
MD5 21eada92eee7f9f9ed21010f29a6b504
BLAKE2b-256 a74fc1c8930e5b22fccaa4f33ae9e932c5a6a216c42228a2140701fe1ccde3d4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202401301701813464-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 792a9f1c95dd05b2db91c1440009e8a85d3d49a1bfb61a487908094facb4f6cb
MD5 9b7de0ac6f0e56cb40e6a9cc5796e176
BLAKE2b-256 7b4e4206bd2a3f1f67f866b9eba0910d448e40fbc128d80d933017b328906563

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