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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 343d3777fc4b3dc82671da563b73751382c92d62dcc6b92fe79bee1529100bd1
MD5 b993456ed3fb1c9dfb8c61796716416c
BLAKE2b-256 3a13ee288cb7c4434d2ac951e54dc017265335069ddb4ff43a093002ef1b7ab1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6752126be5f247420b11fab8f7644ac72d05463297a1805ed2fa6f66626d4e4a
MD5 f48d04eb58daca3f00598f92a0586b3a
BLAKE2b-256 1a66480c37324f9ae1916c34a5d00b3b1a437c2e824ac95b690f5e319ed3a464

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7d2e408f257e4d90365e40505841b2084780ba1084d3312e052e4b0a1cc9796d
MD5 aab9efa3b6bfe0b67bb1a49a3f339b3d
BLAKE2b-256 23a3df9f55e0aa9a2f7e96ffce0bea3d2cf670ca6e48d21b60134b55e30bd5f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a60a0983d9ff1f7ed6075d8004e7eadd64e19ac9e3cb446bfd36f9a465960bcd
MD5 16c106e436022a4703d144cb1f492d63
BLAKE2b-256 65987497789ef187790cf36c40996a667098542a217a72b6e28d5d8d4232ac2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9fb8267aa14ea16afe120f51cdfb9da66436ed89fb8416b358b53ab7af567dff
MD5 590f916b7fc7f5482753726ba3e377c1
BLAKE2b-256 7c238b9e77c8b7f678a31b9b4c5e743b1b7b1d674d333083104c672a5bc195be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 41c0899b0fcb2d189c519466ce4b4d41a376077dd8e4aeb6c13265fd87efb0ac
MD5 e39597be6edcbac3206007ab2965cf97
BLAKE2b-256 5ab15a4c2f10e7c3e7685e1dfb6bd453164e3efd944ea881b7aa1c0c130b677d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 698a4ebaf332065e6dcbcd232f8e96674337133c8c1ba27ccc8a55ce38c81664
MD5 dd5a71aa43a4bcdc3b2fcc4dd9aeaf31
BLAKE2b-256 088fcc8959cdaf36dd26216c04c6634653d775d6225d701f0835ad9b4a80d851

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4f9033525e9c4e672303fcad4c137774c2894fab44dee2d66c9a9f3159dc23a7
MD5 27dea840d70a61abb7ba758be63fe5fb
BLAKE2b-256 138c5ed7a186049b099342d39df6ffa96ae7bd3ed88309d1f9ab5cc5e3e4d8db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a68574e7dd9ebe7a65eded955064dd29d1ebd0f1cf98437200888493fd559620
MD5 1dda0e51d18bf80d8f8d4dbda78570fd
BLAKE2b-256 edd3cdea753bb407cc5309c515d8eb47872e22518da899a0c66495e7d02b3b6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aba3cbefbbe589f8d56a6bb5248b0b54f2b62042d3040c015d9ef70364993480
MD5 957e03af0f1be7bd9553735a2b0a1f7b
BLAKE2b-256 318fb0f33d46ceeef1eafd759734a94d693b5869473fa6f7c2400120ac026445

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1cd9645c40d990c6996361629cc442bc7cd449022b9e48213354bc5487f22b7b
MD5 7db676b0b86019c0ea7b8212ed3d8ec3
BLAKE2b-256 10ca197a92d6a19887421cdd6adf2dd4d95970bf3fb7044641bd46812d6c8f72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 476f529f475580b68502b4208e6e9001ab9a1a8dcf122e6347ff9fe27e8a1d47
MD5 2ced1b3be08d7e04c815958210977b27
BLAKE2b-256 ef47d78b62df006c84b1b60b9d3e7155c170144e39354e7029f577139c602e61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 255d3a943e4f019e63331e52f62562b3545d782290f72f9a00ac0b96f76e8ce5
MD5 332f8cce7820db94f5125882f99dd2e8
BLAKE2b-256 9f22c36862921eee8b29646b799d0fe93e4c7f568a50e37e2cc5ea5e41fdf2a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b47a91b59db3e6a0e47127d154aa10cc9cb93f65a4161ba43bd6346551a91b94
MD5 41b8005e160def98eef64b983981eb6d
BLAKE2b-256 2b1b6c635e3000bc6f359d3aea2892b09213868b5d08c2a31b49a2b593c93e5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 420ef71926d5d04a8941f3320bff6cc7d16848e35b3457277a62566cb757ae53
MD5 62086b0a25da5878eb4c367316328b01
BLAKE2b-256 a241113c7e9bda699aedbf7547e822a6df3d4809900839d35fc2681570cbc8ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 130ab3249bd7af28495f96540cbf4a3b4405a6023ac63b96bc4829d320fefcbe
MD5 1e384a8afb6c6bc27e7bc47dd784ce19
BLAKE2b-256 6035e8e63f79be20b9d3ea234f2d8778e0c62c14c0a1ea5965213dc712b9ee52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c89e15f7e2d00d57a0574e5bf738d220de465f88e3e8102fd6edce4282ef664e
MD5 63f0815de81227801e576137d1004386
BLAKE2b-256 7935b0e4a814f682cf3d3a603362608dc5d346e9181ea9ae4786947647818c11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f115cbce158f455964908d575aa8d0521a1adfa1c989f4e1656989252fdac5d5
MD5 e24916f26219bd13e0c274c095d21e4e
BLAKE2b-256 0c3102e8c5a86dbcc9d0ef09d9d6d7523171c4e82900e235d14245788f049d67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41b16803fa3043c7adcc346e872f1984465e5b964e8922f1435317bfa5bb4e06
MD5 3475ae5d9f16ad19ebebd617eb372273
BLAKE2b-256 5dec72d2ec24fb12eac342a55db9eee03c2247c3f89e679d2f88be26778e28a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1d86795a086795b14ad1f47bdc9433846d44b4bed466c803743c62dcd6698c32
MD5 8c5a4a33a225aa2110a81e0a431973ca
BLAKE2b-256 48b952dc1750791e55e6869d9b00358538bcd8c07e5b1296480034cca8dfa66c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 efea866d024abaa65295c7112831722dc9706c4205eac2d1dbf9ab97ed9478a4
MD5 1f705e30b746f090b2c03e75626bc26a
BLAKE2b-256 976676d305174bd6bffa50b4199ff58867ffa7887f8f0856046ed2cdd215e5b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5f8e01f647b0177659ca2fc2b328f10b8d0c09b6fe002ac127de6f88c0aac61e
MD5 33bb10366af329fbb12ef6345fbad659
BLAKE2b-256 42172f07e8009f9ad312064edd4ddb752528ca13fda66e8ab7b877edd26ce5d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ece9b8db8b5df939c7ceead1b9f82f00ec89e0781a19245ccf32d86bca41d9a9
MD5 ac0b6eef74afd3b23db2b4203f1598f2
BLAKE2b-256 bab99734fb1f322938727ada62830ff677b5aec111063d493e650534bbcb007e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41748bf00f7b86c0ca525521731b0fbce305dda37a06b9ad53d0f43f454f8683
MD5 8fa5cfb5fb6000b5009aa3cf559720ba
BLAKE2b-256 cb7e721ea9b974bba2b71bc3f6e97e37b117358393367928b3ab59d51df73720

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403111709747362-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 408c041986afdd490a1cc4f31095570a5d49a6a2fafed62fef9540ca28b238a7
MD5 ec0ac9e8a214659abd2c68d6e1485f63
BLAKE2b-256 8333d835aea4cdc181e77286532de51d410162d38adbaf3b7ab8b9f90952a0c8

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