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

pyAgrum_nightly-1.17.0.dev202410241729615378-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13 Windows x86-64

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

Uploaded CPython 3.13 macOS 11.0+ ARM64

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

Uploaded CPython 3.13 macOS 10.13+ x86-64

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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.12 macOS 10.9+ x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0bef32b4cb786dfabb4091caed2e954a841e683207ce32366866e4818b6080a2
MD5 3faae0a81f79df9b23bf6e62be1dd3d8
BLAKE2b-256 352a76e79ad4970271a71854b727f0246c672cc935582571c9fa45eb1667e4e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1588f7a28c2ecab2dd5604ccfe3e27427d0e88172e5b1b5734a62ea8bb90b184
MD5 caa6e1afc54ae2cea84e70a20010f502
BLAKE2b-256 cf65e6006de03acb3901e6fad2bddbae641da945ca90867c0c6a273987b16c4b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a4f5b179ac7412bcf4f003dd1b206773d0b3e4992d5513cf7109ac1c2ae3a987
MD5 1905c84e31af8197bd3a1a9620d88795
BLAKE2b-256 15ac4d20460fb28209ae2286d0b7bbb3985d3f5423136e14299988ad758b3400

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 47b93e70d8a3b11a90f9d5a40afc77f675fa1d3ecdcf2bcb132c5cd433eea3e2
MD5 8fa82afd4cd08d10bca97789a9857319
BLAKE2b-256 cc7664ab4a1106831a77c635b3cd06f911929efb067c4a1bc67f0c2d5484cc7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 75879ed3781cbed76f747ba5dbb790df852168805453658738356a4bfa3448f0
MD5 ce9aa758a07382156b73c5176ec6c98e
BLAKE2b-256 0ddb3146613a06e3358975c4596331cf84d895f9db9104411035b9c51596703f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 602737ebbc7d2b4c554a7fe84ad2e00e1b5b93ec37499ee6c4b66b4e6a618eb4
MD5 decce2d4597d2d8a2d9c4b0e797c6a50
BLAKE2b-256 76044865032597c099dfcee1adbf8e6a87fe9ef983764e0dea03b8d2301a9af5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57a83cf336f671ef42d0256c3154596ca30e127b86ada195b2b4180034d7302d
MD5 4529d50582bbc12c3f99191f31e89436
BLAKE2b-256 eea689f2069e99aaba318387349f316a823bd47031a17ec8afb23bffff9ca7c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f0332618bc07c92250aab122760fd3d4360d9aff5f972dd52e2cb978931fd09c
MD5 4da7e026b90593f325e8dbd296a2e9aa
BLAKE2b-256 622f42acde9e3b8a7a58b6a39918efd0abbddb7e7c68c652bdf739e79e36c580

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7cc2c3f7ca494c654035cca9db4629b77c23e9dc32402dec3f6858a0f23aeadd
MD5 de6d6e7c8e35fe2e26549e1bbeed0925
BLAKE2b-256 097300eeb0a1cb9455bfe77f7a27b454826f96b586843122307b11eadaac7976

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f0c56de7815acff48a3382c0303c989b1bbf48b2f4e2b51db487e2fe0b3f3c07
MD5 bacf1d5d3287705cf75befe32281ea5d
BLAKE2b-256 8aba436f22e33cd9fbb3b767947f88953f8a36b6e9809de2cec7e779c67d76aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 656b61a734f4c279d662a473909a71291d21241ae5701c803efd5a921eb7f620
MD5 3df98570b1cda63db1a2f80f56a0ea1e
BLAKE2b-256 46a446abb08af4446448e511657ceb13e560831892a2b65208d63692e8ceae90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4439e253be2013087ef5dd169a335b8c4893eda1a9cfda5d117334163b64cd71
MD5 b762bd2e59625f37f26537dd9e291353
BLAKE2b-256 2c67cceb667dc9adfa3437ef9eb1e6bb8c69eba3e70540b2bba894daecc74cad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6cd4055377db0545367b448141e835012149fad6fe8d540b40b731c9ef5e7207
MD5 09af93cb83628764fc1c3b6070953442
BLAKE2b-256 853cd28ab3c3a9f58e293e74e880a8272592ee86896d0982d9119364fb37db6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cf4e1287b9e24aaf1fe567f10b54b163d2fccfcd6e50c394bb8ba1180ee1fd73
MD5 79ea193f497e813005a888042e0fa0a3
BLAKE2b-256 5e424f7358f1ec0ad769d7c4bf6fa7864b5811baa015ce7cf873716d4294234a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 79e51fdc0ededaa9d1dcfc01d2eb3661c7b62338e70be8babb93a2c032a1f913
MD5 98fbc013d77976a26806129491dfc193
BLAKE2b-256 5c9a2fcca4b118fd7b5b6283c25b897fa1a782e2dfe1224dcfd2249632b6110c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 619c67b1f2fb9bfa30f8c49a14d1dda96ef5336da703dc6decbf13a81a194001
MD5 44026fee02cc79b6f0f5d58903f4e4eb
BLAKE2b-256 95cc0ce35647ce949438dd54176a6d08d6db8e15d7255ebad3e54bcedd250931

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 03959b3b89632382bd5e00074cacc4a300fa1b577e8c8010b9cc3068228a8d3f
MD5 6f5acac77cca41cf3c1980c6ba31b9f6
BLAKE2b-256 10fa72d0b1cb64c20ba3dc24559989271235454b281cd135eafc3941581dd99e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 887d9f1b13d82c16982d5283d6b2e3f1d8d0aad5c3047bff60fc14b08fefb038
MD5 6e0d29d6415d2fd11132aa55a6b49a92
BLAKE2b-256 ded12c7d3c94d0ce9c1befc8159dfcd2895b20244d87dcc7d76563257e852b39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9dc0d9c3a68d6b306d40222592e2a6841ad5b9ef5fb22894236ffacbde3ddc4c
MD5 2ff590e0a81a8e3cfc627ad567017f18
BLAKE2b-256 d0f4d2fe9dfd2ea15797482aaba146ee618182b6783ce290fd1ffa6e5237ba62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202410241729615378-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e451f31b787999004d052aeeb534d09ae390755ef996dce7e18a9cc62e42c17b
MD5 897484baf316181db4345bb57e5cbb50
BLAKE2b-256 5f0acd80f314c6b1267096b49ecea1dd4f835bdc638f2a5cb943cff780ca167f

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