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

Uploaded CPython 3.12 Windows x86-64

pyAgrum-1.16.0-cp312-cp312-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.12

pyAgrum-1.16.0-cp312-cp312-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.12

pyAgrum-1.16.0-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum-1.16.0-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum-1.16.0-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum-1.16.0-cp311-cp311-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.11

pyAgrum-1.16.0-cp311-cp311-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.11

pyAgrum-1.16.0-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum-1.16.0-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum-1.16.0-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum-1.16.0-cp310-cp310-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.10

pyAgrum-1.16.0-cp310-cp310-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.10

pyAgrum-1.16.0-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum-1.16.0-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-1.16.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 91898a0989f71fd0a27cfc58c78ce3299e349f0bf37ae85482520828cea972c1
MD5 b3d328b1f5cb838eb86c274ffb475827
BLAKE2b-256 fbd1cbf9011c344a32188ff158adcfd95bd203c28404a3b2b6bcceea8a0fe4cd

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0a820ea47d1e3dec2e1b902bff434cbc8d05af2178ecc0e0ab9713c6a862a4b9
MD5 ea0f266151a9def5eb4ba6d9a872fac8
BLAKE2b-256 ff0643bdad8d0beea162c82a05bbb606aba8546fb8d3977c1dcfd4ad90a6c0d0

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6eefa7516be084c36b9695d55cf6147b030bb20831758d6194018a0c08c58b68
MD5 a6ac44a9384bcd32b2a94434d400ee16
BLAKE2b-256 8acb1e9488d6e52c58c0fd3e4f902206b98a97894924537acfab3c7c6a98c9aa

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bda10445e53615dbe08eb31f9e73f9668a5b189efcd8a52059ed0945fffd34af
MD5 9cf38367318b73a353fc8a3d554ddef0
BLAKE2b-256 37e4a0cb38e814008268ad7471a0f497a53dd87f6393c9c91d5f1803e6ccda59

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 49c9f5a68270abae3e1e30b6977913fff609a6ced365eecdac5cadfd42c22927
MD5 2b30acb2bfd5ad709e54e665024f04f5
BLAKE2b-256 efe465e5b34d3054461a84b8f6df1bfb699399737c1b67746230926e792c350d

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c4d22b74cc3cf898648ce15728835f5c0e81dfcd2fab6a0bba7b74ff8e0e0520
MD5 f7afe220c23457965689d1da1eab7fa9
BLAKE2b-256 32dd41aeec784247579d711154cf711e2822447e8798e5469857ad33a5ea00c7

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a6396a5b9c295b09928785be51e13752ce6c2e82438c0c9bbe02112f498bcde
MD5 6ee1dae8f8adace0875e2f61dd491de9
BLAKE2b-256 4257365ab776abe85716de706586eb1146ddfac58833eb3ae4aa0c302cecf56e

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 76330f3bd39eeab2361eeb04a7137f503e8284674fb5402cce383d630d18a5a7
MD5 ba7abc717434cf47756c88b7995971a9
BLAKE2b-256 8109f983b4c50436980f9241bead9c5da26f0456d3413a3c7c8767a880de7201

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 94539b7397c081dd807ebef5518e3bb9b6a5aa07b5fb6e12f369d5521abd7199
MD5 c4c804e5eb13d7623b9e35dd8449f597
BLAKE2b-256 086c50947b558dc48f34a074076f0b1550c6bee6d54ee2945fa22816faf0acc3

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 090b26125b406a868d37f94dab859c5d52252f9d068e95a584f94bdac91d8a65
MD5 bef84bb28e5e8ac10661aed27889ec9c
BLAKE2b-256 b21f5d1b88d751eda0d868e9d370909aa165388c452cd3d3d6fc71c629a060bf

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ccf7ba600f11072f43bec8d00e45124c331a040975bb0831926842b6398a2f47
MD5 dba5bcd27c0d97e7fb95e1ad3ca48ab1
BLAKE2b-256 d84d0eaf57cb82d784a0270b8f301ff7624b61507d5435d07c3519bed3e1e092

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 29ca397ad631e43c9be1e0423dfc3819714e36eaa855fd1a84459023cc8ac134
MD5 463dff8e0a481384314270a552ff7bab
BLAKE2b-256 4c65243c80553ff222272f78cc54d91952a042dfd67b9f6f62a77e0b6b35a5e1

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c44d0f6a2b3ca1b33a4ae2e1ae9ac574862303754b50c274d3bcbd4042a424aa
MD5 61ec6ad6c1e96dbbc8e5fa5adb34a4a2
BLAKE2b-256 6d826a9f7e927e3dd066d7b8f181f474dd31beb13da6920a108da93c6a8441c4

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d4773cfda5994351d3b66e813d512b17729a0d49faed834b75e102ab4683b2d3
MD5 866af4e0ca2a7855288753620332621c
BLAKE2b-256 b8f5fa8e4983b4e345b6cead61e2a5a0f7ec8a75767ae392f6d7cb77deac44bb

See more details on using hashes here.

Provenance

File details

Details for the file pyAgrum-1.16.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.16.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 df3bdf5d9677ee35d55b0ecac8001a2ebe1a2b2f01a8043e33f0696be2510af9
MD5 cf96233535a815fccd95e676e59f4ca9
BLAKE2b-256 7b4b368c92d4f0163a5f9f800942992cbd98c7add3a680830b237b9ed84b2c6d

See more details on using hashes here.

Provenance

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