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.dev202403241711221216-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403241711221216-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.dev202403241711221216-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.dev202403241711221216-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403241711221216-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.dev202403241711221216-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.dev202403241711221216-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403241711221216-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.dev202403241711221216-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.dev202403241711221216-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403241711221216-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.dev202403241711221216-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.dev202403241711221216-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403241711221216-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.dev202403241711221216-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.dev202403241711221216-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 93aaf6521b93cb4c0eecc363afb656614020340a369f7861ae0ce54fdfc5be93
MD5 d340e96c1ff4a04542cb4a52b1b44570
BLAKE2b-256 7fa56e345f8426e5d8ace30eff4f07475dfe4ec6e63d6f000dd0c3fd11c96d25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f3ab4c5b6a2695ad40b2a80304081e093cbb807f5106b6403790e13d46d1c1e
MD5 9f437a5ce8fd8dd80ccaabe76d42f11b
BLAKE2b-256 6e3baeefe4d64623fec4b31a11124e0a6b5fa9c51a32c5c869819e463e0c2e6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3e25ed7db969d7528efdaadb7875cafaa1a7b22443edbef90d35e806799a27c1
MD5 b03596f58118d384bb1cc5dd85891775
BLAKE2b-256 98cf8aee0be0bbf4bcb6e537a91025ea81be49f3455f7342544cd575cda7d15f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f95e978ec6f71211ecd00bca34f4bbb5885ecf4a575d3eacc5369830a7d9596a
MD5 df606452dd0af35c653e38041f80e75f
BLAKE2b-256 10586e2fc4495d90fe49ac3132922c3e074c54e22fe993a3025a98217d1ba6ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ed80edc7b5219cb386c8bada44043bfa131028395c40458eb43f079306eb1b65
MD5 b1a4faa55ff17d4ac204da38ba4a6f44
BLAKE2b-256 c75b958fec64135bb6de9c2a24948c279842d5f91661c450e50f4bdba96e64e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c134a37f1bc2ed9665cf7da568191012aba35fef8d8912b2604ab064dd366ec1
MD5 29d83bec1317f6d70d260878a95d737e
BLAKE2b-256 035913de10ddbbe8fcfb512b9a512a8518a151ce0e543530f715867e22322764

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 057279d49da712e61300e97d627fc6f09ee50f2cd99ae516c5116360dba68231
MD5 1f9bc03a36fae60ee1e9336e76e54391
BLAKE2b-256 3919193de77ee77a74fcf387113fa2ab0787b42c2702bee535918d03603fd23f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e41c4e10a7d0fe0211f76f136b309a4d149645c9dc9dcc261513454adc25a7bd
MD5 01daec73695d672823e636b2f36440db
BLAKE2b-256 052aa3cf60db8340967a79cc936933e6e2c875dec77fff34b6510b92488380e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d67bf524c3eb6c046ed49f2d44b28fe5a06b7d5a25d26c5d89b6b57eed8ecd86
MD5 0abeb134d2f8003c23cf39c6465c348f
BLAKE2b-256 9b13819ebc106e55e9c4e92e3f811a9a2352d8f13a1de2f38a6c5cb4b432c214

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8722b6585eb44d6b975c1adf64e57e9ffff909bdccc551081af752ef829df9ec
MD5 1d4c1eb725b5d8b355bab2bc30452104
BLAKE2b-256 25a206e85bc8994cf59cb922d6e94ad6f55d4b54a6856ab64593d5ecd39eff38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 10da0351c2699bfc230f761feec18a9131afeaf5ec4af199792981d7932f5e8a
MD5 48d15e5db151b0aef8d1375ee8989764
BLAKE2b-256 8472e3d1da8cd4f615d51f6049bc4964054cbb8a579edaa85c00526443ad86f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9e00952c9b817ea0902a841fd10654e25dc87154b6d297486d27bec57865bd2c
MD5 7d0a5567738d8a375a32e80aa04a15dd
BLAKE2b-256 79c72dd11cea947a884a461f0609008c359078040d8105f5e69875bba92326da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0053b5c4183bfd1564aa5adb34af6f981b1e5d8a8771205b25050aab236dace3
MD5 2cafc92fbd0704291297849fa1b5f991
BLAKE2b-256 03e5995ef47ed4ffb840c51e1191e13a8258b476329ff956f9a46effcad6953b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 152e4a76b02c98f0bc60506d445dc42b3d4456e0078e55141bbaf13ce267e741
MD5 a853cc0fdc7cb41953739e2a9f1da06c
BLAKE2b-256 8675071d5c35ee495fed8fd57f1bdabbfefcbee146a2649d58e551f100102f98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4b9ae29adb0f275c1a84cf95fc859e2f95d22aa1a6d11a9a14906cbbc5e221db
MD5 24d55de4cae1859a47503520e0f3347c
BLAKE2b-256 b8a79719c1964b8c2205709a892324643948858a1d3a152ee5e607d8839547f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3c68b56e8e42228f639a6c1256829700d9774380457bcbfd8b369c9ce39cfff9
MD5 690f99078d4498494dd1c12e06e0731a
BLAKE2b-256 70bea679dfedc9ee44134967efc0f0a779d4d5d969040e9b941f5a8e82c5f89a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bcb0834cab532b196965e3deeffe692bf97a3131c1cf55953a57f99cfe6ec26c
MD5 98a8fa64a5a2e0db68940819e6e769f4
BLAKE2b-256 dcccb0d336e777238ff0f43779161cbb14c43269061c465020538a0bfc97585a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1c51bd558cc94f3de822ba021774e0e9e4d4f025dcf587a86a13b32be4e1da47
MD5 8d38fde65f2e546270d189b761e88ebb
BLAKE2b-256 140827251f3ced4245b9968a788ecc7b0d59b5606c55800145a1ee0b7831a2db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5e9e1a4aad81474850005074124ccfbd551f3b1fb339c5cdbb6039128675098b
MD5 5da02ab9b30c657b19b11ed80fed144a
BLAKE2b-256 2b38ec541b010610ffd32f5a9d9f8c98d4bbc6a10853bcaebf61f738b8bf6484

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aa1cb80082efddc3a94d7b66ad4224b34feb1d6ec9ca604c4ac7cd49670ace2b
MD5 ae3b09a20ecb13e604a2fd2645ca10a5
BLAKE2b-256 27336e38c0a7838cde895ea11c29471e5603276d6f301f11bd91a60588198d23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 00c271125f8e03f0568ecb15b035538c2692f36277552202d646efa05ec6ef0e
MD5 0c10ddb16e7a431046dd96b9c5eeb588
BLAKE2b-256 f8913260dd9713d5d3f3c71108ba11a103492be105bb8538ae645cb74342e951

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1614066d53c70ce1d70735b09e4d1b513d7d7223babc8cf0a6fa199aab781d40
MD5 30bfe477d756d01310ccecbe6d344205
BLAKE2b-256 3a628313a60af63af4150c812eee5a8ee3b85c5539a88ae2d506884c2c7c9407

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6aed0094fa6ba93edde485578b9a9352ed78a8b8d07c0cbb83cc992ece93282f
MD5 a1b35b55bfff5aba2d9b7f7352473cfe
BLAKE2b-256 5151c8b489118b94bee884f626e019ba97717f981e667c5ecefdd79a6f750687

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e3650071e331986057bc1c7595e0d9a40cb6197254445513266c2bf07204af5b
MD5 58d3db4ac8a409ab97d0dd4356918dff
BLAKE2b-256 0c952774b92998731955eca6e7a486225f7a3f6cfc95cdd586bc07802c3c8863

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403241711221216-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4dd2928c74f038f0b667940d23003a7b883a0cbc009dbbb10ae6f92f717ef53d
MD5 104c7f1c5f760e70e3cedf59a83d0b22
BLAKE2b-256 73758e5209eff7c5e20a9537fdf295f6be1ffb39e16100d52c2d95341716d127

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