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.17.0.dev202410261729615378-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 05b672adaa33b7658929d85db527e3ac8638f52922043da411ec6dbb13f63907
MD5 484bbbf41c71397aa734cd2a61384c9e
BLAKE2b-256 b20183a3fbd38966e1ddbbc9d077642ede7c9c966927872bc02ad48e4ecb2c97

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f09b949a39c8fdeb307e975b4de8ecf00f7e11f5994f9a79a4286e6c111839a1
MD5 d05c70dd3121eaae84697fce9ae3e76a
BLAKE2b-256 a461c791c03fcac8449ea0138df4ad6f19eebef63df7ac93c8ead6e08d1ce5e6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4fba283368fc1704fb3809d661152f3a7698f90e9b8cff8dde10a300aaca7783
MD5 3efe14e251932ff324564df2d7b8baef
BLAKE2b-256 9e3ac67f83f21badb2c75ce2818e6fa6bc37847efaa3487e46f4b76dfa98c233

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a5977d3ae93055a3ee1322b37864399d5e5f4636081ee20da3f273028cccb9c
MD5 3276ded9f264efe8fb82572db5d75f6d
BLAKE2b-256 68347923041378c735bd2e8fd2041f0e87976c28856ac07c951767880ff308d1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 39177ba1e5402c7907121825f16bb2ca540708f700e89c42c86cf1d9147e03f8
MD5 9e6471a22c89b5c9535a6d3037f48e85
BLAKE2b-256 cbf1a484de53086add0ac36b13703222bf4eaf80e1657c481f52346535403b42

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 91b292780d6f351485396d52aae0d0aed12c725ca83234df4bc1098b53b8d167
MD5 e633a7141451a02b9e511c35cb50e210
BLAKE2b-256 c012735fa4b4ebf89c9250f1dea5735c92f81a67704b0940e236403e5059d19a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83eefae79405bff6d25f7f189ac4f45865dfd4d9826b9b213d736da67d542df4
MD5 63f48dedf84c52fa1c5087c4299d7d1a
BLAKE2b-256 3b608869d661ed92e27bb57d28568a2e4946ea98937e68bc57c776fae84d6b47

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4948da8d362e6b09581e59d6264a4788ac34f5955db7a625d560c97a9a51d322
MD5 f009ffb56f4b941d386af10105c0b68f
BLAKE2b-256 f8f7ddc02e6caff3b1efd534d7998dd5b3436896aa5324bdadae50af44f2cba3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4843cc7b7968c8ca7bb483a6dc93c8940b705a467a8e1f6a628e165ab223d416
MD5 8ab6c5845f1d37110797764d8f73ec50
BLAKE2b-256 ff85cf94e9f280a26b1b586cee4263f3cf81a74595289d72ebb8cec6e3032876

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1bc1c586f78f91f43fa154268e06cd4eeae456e9cd331882ffb03a447c94b9ee
MD5 66bb93f3f3d5914f2c4b3df3b9543a6b
BLAKE2b-256 e997d205931606774fa55b184ce582aa0f180b946b160142e8ef72b78225abb0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 519a93e3366622c44800218ca4d96369672e00e60b7eb0d953c04bee9f923693
MD5 e3aed37727c415f8b7687830a9d6e3d4
BLAKE2b-256 268d9f814e6565d2ccc4a3a87b5182cc401516c48608124b431da605f3caf367

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c760b6db5b3124784113a11027c79ad5bef457bb9c74c1743f6c844b62e69a94
MD5 fc361ec69c7d4c3f27f51e006642ef68
BLAKE2b-256 dc01f2c7984ba8c25a693edefa2fda4a8a718e7dc5d882c8434456ac61cf4847

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 654eede732f198851959f8c9cf87660d401ce6e7b92e19919cb755da48c3692e
MD5 2ff1d217d7b9a8b1e51c2511ae221a53
BLAKE2b-256 dde335c7ef0ea7ef4f628daf99ac1e7db0a43c11e7702d75c42282aec3c85cbf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4bbcc7c7bddfb2ec09f583cd0be7f771efae9c7ead9460b024fd56909310ab1
MD5 c99fe755d5d0aa2e0dd3e530f03cb44d
BLAKE2b-256 e5d010562df21fb7b93b4b6a9190429529e2891a63a75c3c6cf512fe1b4032a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 605152d41bd0d45d828c1a44cd016fd7c52a716cbc264f7eaac857b50f4f50c7
MD5 aba2dd7c99438018f84e40d2fbe68ced
BLAKE2b-256 6abfff31ac4a35ab647f5bb5667882ee1eb88e518b4b0719ca38a25b1c6601f5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 daa0770a67f53df1e73d5b42ae744ee431c781a71f29f09d376636aff4af5990
MD5 b00e93ec8348585994530e6ba5499f5a
BLAKE2b-256 586ccbe2aeee7f81b208f1c4459d7d02cd93c755b1cfc2f5894c42ddd92d11fe

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a7c26f5ccee40ecea4146fcc7dddbab362c3073bb56dd33bb2e2088dfd87280
MD5 26ae7d3c1bf58822d3eb330566fa0b9a
BLAKE2b-256 fa25c8832c7fb1f6b9cbbe5505e6340d671aeb6947ec433cc444bde80ab4f395

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3854586b5e5d8bd2487cc849bff04deb50afe19bfbca0943d4ba354446c1acd2
MD5 e7194f4e1a832a6fc5719268abdb2805
BLAKE2b-256 5d26d6e0a835141b7ffb1e891a67c75488e0a572b7966cd7c04eedb5d63178a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 13f17f7a937bb0b436cf19a1362768598dbe0e82fd8d6256f6ba92d641577b95
MD5 164d0e7b2b4d0e919ae672de12719c97
BLAKE2b-256 6e51db3aedb0aadb0053c046d755d9c16a572e8a47548791861d8b225a8fa9d2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410261729615378-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a31a2f3632485f372933684cb91d8a7d2088a08d6e7900a1e2a52e9fd170640d
MD5 d75fb8dc2aed8343bfaa889c3fc1da99
BLAKE2b-256 e84c5caec1312b34576c96a99e7bbd6536114f19f90be2998a1de81b5353739c

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