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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 83518e5b40ad3f351f6b18c19066ba51ae8022569ff6230d7cdb6b2b66d051b4
MD5 34e190c7406e4b8dc7c43d9e8f2782f7
BLAKE2b-256 0aa607c81a568e192b0a847ddd62e596588b283458f9b61e2d79a7e985131bd5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f282247392a4e141d17801a32efa1bf8973717943f64e410fa33af401c64d32
MD5 e446dcd69b9fc94315ab30b09010ae66
BLAKE2b-256 b1f900d8c8acf7b3ef9e19ee38e05eee9dfdf02589931c9524777ae8c0cfcf7f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b755b9e80d34a8f71a03e7877036f5414ff7357a45419063d8292b6fafed062f
MD5 720c48f5ae481843b6c1aa6aca3aca74
BLAKE2b-256 1c44859703cad52438eef90a8ef2e4d24e5a33a44a6ea48a22f5800e81d2d1bd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 105e200e48f2e6931fd875d79776f8e5f2e853b2a06273a72f333cacdd3ed8ff
MD5 93db7f34d7a248532db0dd5f02c8f952
BLAKE2b-256 4bba6024cb773eab7f7e90d8d797ef783d35084ad570a572227948ceb7f40768

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 87d6d333b80219b0885b7b47cb047f9872a82782122fbad9128ceb8fec6c532f
MD5 2c1e5efea1b3ebbf76c77b0390520d0e
BLAKE2b-256 9151b94eee2135187f508c8d5515fbcbc02d68a52e9bb388892c04961f72d3d8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 80d5f0ffec2048c40319a8a646606d77be63670dd93f633e7f574498195d5e4e
MD5 ecf2bd6755768d156e0b42067b343a27
BLAKE2b-256 0a82fb82526a2beb191d29850b30399029662ed7781bdbf0c894607d7dcb4ea8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a3e95521f7143c3b4c65ca580bc63de993258b355313f98d13d8f70f102e6fd
MD5 3f898a3d2662e2c87bb75e6f5aeb586d
BLAKE2b-256 e20074098c8164d327b96b66e0602027f16394b4c28417d3fb70d045af686888

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b6d764e2359677f05e5bc0a4bac1d0b5ba9d95197bcdd61001395dbc67c9c85c
MD5 88486202e58d2fb20001b3a616391596
BLAKE2b-256 9284e7949f6c340530f1ae4390f038e90f667ba2b4ebb024bdcd7050923b4dd6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e6416af2a642fad23f5fd965ff4c1bbc5150194c5bd1b3ba9a96c20e800221a
MD5 002a6368bb394b359d4c0c67345d1116
BLAKE2b-256 a3fa48f6368c63abfa7e36b95b860898857b28ec5edb65394edc6a361b890ddc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 58052826009cb532557ae8fbff6e7d95fa213a34e945a06fda808b276812f191
MD5 ff44d808796b4f094e66e01ca1374021
BLAKE2b-256 317da5a41d5abc24cc9bfb4f16c19a63caa02428e64ccff4814a795f2086a167

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 214854c413c1e27426c5b9cbf87a10d45a850be3597a3b5290842fe4b98b3062
MD5 add9e8db54771b16c6a114fd6e81b50e
BLAKE2b-256 64f79cd3662c249c4c5225061b2f77b70720818d60348a4e4333b815db428d64

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8b48d7d7370c93d0a82d04d2674236126e3b0d1828a03d6551a8969c64128141
MD5 c40ed85cb48577e73884ae603119e3ac
BLAKE2b-256 85f50f6772aeeb96ff133aac00f6d9139fd53165ea0d965af95278dcbe0d90e6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2bb0a7bab95926bb6fc5225620fefa57bef2919ba0dd3d8be33073b588da45cd
MD5 7a29d56c9187e8931e0a9e2b2a2e6106
BLAKE2b-256 d04d6b0176ca4f52c49f700ec298ea7313ddc05e015563ff6d16342a2cc4d02c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1142cf0476905392478da8d59aea3d00256c4d0bdb790acef9082bb8f01c4c4b
MD5 3914082ecbca9ef4b70182c8a10af435
BLAKE2b-256 71f9a0efcb3fe19053a9542fd9e913c547338df566b62f395aaf6d37edd6d845

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fa51b2f3e3644b7db2f07879f08726f21053dd4444db1ae13bbd501c9674f16a
MD5 d9f91e4b98b0d6d47eb466e76172f4e2
BLAKE2b-256 c5e8ce117d54e9c75f8b27af22d138a740991d42bb225251d0950b6f8b3d092e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 38479db782a05cda1646a7410620079057d6747c3c81acebca3d0dcb5925fa4f
MD5 aacd0ee8b3264ba9eea821cb9cddbbdd
BLAKE2b-256 c2203f413bb9664479b7786100f15e22ea05fc6707ed988a7e2cdb9b09b632a5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 463bc38da1f049ae0ae72e4f8c8beae034e493a480c833134e821b0cf01019ce
MD5 2a4008f309f32a8e654a571ea9fb5428
BLAKE2b-256 349b38d0aa8bbe13d51f5503471a47ba0976d31268a172d5d7a96a8b58b7ea91

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 23377cc0af3d6aecc4fe185ec1ee23a53211756ad5164d05e3ca7c723985023c
MD5 3f450fe386d141bc0ce2706bb4194149
BLAKE2b-256 fdaa57e92020ec0ac863e024fb32d7ce87f26b567e4f7e9cb958386991cc97ed

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5673f1871cf7fd748af75be10a3d4929f4ce0cbc9bd817acfe815066744ed2d3
MD5 c7421f75ec24dfba34efc3bbe30c47a6
BLAKE2b-256 bb08ee063925f9082ada8d27c6fc2e75116f6868ad6943850e8aec8f65fb3848

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407091719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7b61705cc4e06250d436b8a0adc303ca7668467adb3dd7f552615f1e4d04783d
MD5 6a6d2c6a6ae5bb3887eaba8a9309dced
BLAKE2b-256 717bf30f7867aa71c2adab85fa556475b6827f03e3e5c796e2072c60e684f00d

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