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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d583e052a31ec822002ffa478a382338eeaf72056fcdae3627caf5cf3a8dbc14
MD5 faaf8991503dd4ba3c3c514d3734f04d
BLAKE2b-256 9fdd9bc4f663ed0494df485ff95b8fa9dd6a0316b5a7a47071366c9263c8458d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f6abe2d2232055b573e26a5b5203fe761d9a1278803a0b61f1641790115e99d
MD5 024c4dc37c1e665b0ce78499ce399c0a
BLAKE2b-256 8d634c89d7fe97bf32a4442fb522218d834f0d65924ba33ce19fdb15bca619e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b90664026ddac1338c52cdc1cea37be6a99fea360dc77b5e1912b9fc2606e94f
MD5 71d305f7e15e55fdd2ec3f76f2216a58
BLAKE2b-256 6e51570759cfb9a74ac7869ade943ba11a2c31e4089879dc5e692d5d461d613c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a514a500db0a098a306f98a3fbb5af89edc0a344ccb9b42c90a2df17d191ef4
MD5 24793114655be4ec97594bcbbc65efc7
BLAKE2b-256 b5bfa4e1b8badd89ae102b07f9c050e58db4018168ddd82ad780e624d197591d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 182a919839b885e0e7756cc8416d715af925240abb876d0865eeb6a00f337d3b
MD5 9f04e64a088ab96fe136eebf7290f758
BLAKE2b-256 f7ba8259ec25906206ed5b5b680a75605d559cd9b22084dcb99ca06b5664299e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d808b1813369aaf65838e2bcb2077ec78bc7f3821c05c56e03a5d604d4c07862
MD5 65660721fa520c8e165b5084d792f94a
BLAKE2b-256 f6faf78ffd5d5c24d3ae6775721b109c0b34e7ca10839ded34e80c51f92034f8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9d1af6aa91ccbca036b500bafb10f4502922df28163fb0f177fc949a0f2ddd5
MD5 6301f5e98a47c863dce2feec555a6d7f
BLAKE2b-256 586683d4948ff2b026e6776b47cd3e10771f4b0f5614c0553e008cda3813c7d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b1f5b2898d15f5fcc5709dbf1d5979de0ee4567cf772eba04565eb1b0d32f5fb
MD5 fe7ee7c0c78fa9575addff626e10df46
BLAKE2b-256 e16209a0fa9c4d03438c1b0c0f48d9065629646ce8ddb6d92cd9f301e1465e5d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bed8c182fa1da9e23dd02ac02e0fdca7815f46459c9b0ccf6e46690bfd9518d3
MD5 9f8b829b7115a68503f4fac4c0a9191a
BLAKE2b-256 9fad8e437a9bc9c48829fee779ea4fa8a25d22393b869c8989f578708a2dea19

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b0cefe26f667c62a5e235a215cdd4b777a79d805994622d88baddf20dd1d3fd7
MD5 3a374715a5ffe3be81f196c343d7f7f4
BLAKE2b-256 ebd9db2a52c9f7a07f121a6c0041e3799d49af0f23fbf594d7fd820ff2657587

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fe97f5702ed12efc20a3fda429fd5984acb2ad9cc93ce8a4abbd5bb4ebd52581
MD5 f1e00f69fdfc20d7a76ab73ba4db4c7a
BLAKE2b-256 6af06829e4edf0e47bc7f46cd770ffb7d9d487c5417871c66943c46a85b0c22e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d780608a3dead645af2d8a18847b4832deac6a6a019c64c32f798804a9bafdb
MD5 c0b8eecc77f095e2f0e8a300839a7f04
BLAKE2b-256 8c02ab80f7a4bb11b12640f6f016f98fa123b1f9b7e5922ce0cf0980b6a192ee

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7a7da5ef52ee6fd673c5f52122531bfb369af823693b812ab5975b29afc016fa
MD5 392c05cfb222637f28bafc30d2147577
BLAKE2b-256 e1bba61a0004855293838042b8d5d1b412590554a0937615c73b0d89ec832721

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce8577eb9cb7649e89c4151f612d94bda07f6ecb6270351c1fcd0de9f8f1e791
MD5 cc90adab8da3018ba9dc0f29ee62a94e
BLAKE2b-256 59fcfa7af90269f01aada39dbc94a1edc36ccfd77f4db38bff7983126f4533f5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7123a0ec7fa07776ceac879ae6e8ff661b426e54de5298b8c929c6379dc98d7a
MD5 c66909a1be054c50d23cced920debc56
BLAKE2b-256 7fed6a6f26f6ce7ed8c3d2b79509c00964c19fe9c64b1c9a4964ecd2d3ec94e0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5bfc5b7c04157c4e188807bde8d39e4db080ff42bae2ec6fca967ee452a600cd
MD5 7c12a63dfc6dbd6b6183f5fe579bfc93
BLAKE2b-256 e202b187e821aee0a0cb071d75faf6ce46d1f7b7a90f5edaffbd0e970610b845

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 db3be51fad266203b1d3f80bbc312c543b8e42b9c816e05589ffa5de24d9a2f9
MD5 d0e464b7320ea97ca6f217ec44f4db8f
BLAKE2b-256 fe78f780a55890902785241ccf0e1604d8973afd770f509d91b8633cdfc0d8e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 097f43cac9cd96d1fd535834493e172e40ceb72c3495ad38b235b3e17295e38c
MD5 83cd4a1130a4b0007ae2775d146dfbd1
BLAKE2b-256 38b6ffe06a966b74ea94ea169987412b857743cb61913969dc08f0c2d0cb7810

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9d156447bb91ed1e9b594b2dcd9937f546d2008af75fdf9b49bfa0f3129a1bc2
MD5 cf1d7d00b64d5ab4bd6503bd20004180
BLAKE2b-256 cc9d1fc1d0c0aa37b67f2605c0bf517fbcd927cf20c996548691a62868d15d9b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502241739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c4e529b4720bf28df019be6873840995cbf410d71adc4097f1e5a78399e8b07a
MD5 de24d65f7aa28fcc6398f4be290ad318
BLAKE2b-256 fbd303a12c5b30f7fa03f1eebd6256d83af2bace69defe6de2aebc5ea8acc513

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