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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202501071731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501071731932516-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.2.dev202501071731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501071731932516-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.2.dev202501071731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501071731932516-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.2.dev202501071731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501071731932516-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.2.dev202501071731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c1a025e03041889d76f628d60baf396b155cf33fe5ce60c1ff2edf1958d8d607
MD5 7cdefda1fcdc01924452f75b0ba5c92b
BLAKE2b-256 cee008d14d0467226e2ff4c1cb21924cb25d1b5eac8acbc01439a9bcba659a43

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 00ec4f4d29b46cf76c8e54d47bc41f3e7918266f57d56db08a2b9cdf55638bf9
MD5 90e25a2eedfa95d9337ca8cc12e31d1c
BLAKE2b-256 b19b815fe8f11c8c74581e29e9ecc817010f82c1cf2d6a72d8d7e832f5e22848

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 05c53005cad16c373a2412a3e3090417e65abe9064e8ae618296d7e1aaddc188
MD5 bd4dfb3438c2b5e12c82c89c454317b4
BLAKE2b-256 5acbdafecf803d964831ebf92e8af97d08612894333d34de1cb62463d4233d1c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 104755598c278e6cfee7773990ed3462f6ee95a26da36a53c03b658fefb4210c
MD5 563515e304c8e89e7212a98ea233f00a
BLAKE2b-256 d34fc8790cf60e2bc36d89ceeefd2b5e5e7ff0650920028562c941d40be50f2f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c56ce5de64804ca16d2dcd85c8a7171da0fc71d26137b45d026221f36816601b
MD5 31e02cb0dfe560548777e4debe7a8101
BLAKE2b-256 65074f6eb977e2de63d298dd54d68e97b33144eb74d937571783025e884ddab0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3dd701c2c8575113a9d8ea5fa71700bf3ec2e365a43070fc8925da536b61f936
MD5 4dd9bca503a5fe2c06b8b74fb4182f81
BLAKE2b-256 cd2e8d501943adeb0882c84cb46c21b435b0beba2cd57bee2f482728400970e9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3bbd4ec007ae8a9d1b4d93816b47199dab9c857ed92bb54c331a78fb71b1489
MD5 ec77558c76d9c50a308ed80e7bd20d18
BLAKE2b-256 fb68d8be228e87215d25405a9d0b6f73ee5da8e150905b9672f07ea596f05f74

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b152cb271421c5462cb05664528736a8321a69245ec8698de93134078b7d6e98
MD5 c68566ec7650e9dfff914a889d85a28b
BLAKE2b-256 528405b09ad66a3a8251b94ca92b62ac1b59b8433d77d71c2706a027d2ae8d0e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cb74aadf74401cfc958c31739d8f5b30af4d49a57582ed56b961f123551a3359
MD5 6529e776f252abee88cfd540bc328491
BLAKE2b-256 3da3d1fc2efcc2d56b714e84f550dcaa95559de7424ec34ffb9c962541d2ae79

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4cffb468ce0f9a2cea79c8e64952d963939f5b6afb8924c3639d34a595d33fd3
MD5 546f2b076aa883a5c2e1f7b32b1adc2d
BLAKE2b-256 66f0d3026926f553aa71165a102589b2dac80c6664c03dc8266458966f02a8fe

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4a6f2d548eea73db53ea34f85a4befd22d9ec316a43e09b40fdf6119d856bc2d
MD5 ac6d014e93489a27c060aee82b693b57
BLAKE2b-256 e2a375753e624aab831c36adcbbbcef026e51d19ba3c4265cbc5520fdd41f02b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 04e0bf39690064f410c641a80dfd89b0f98cbac054bc53c694e087f2e3569821
MD5 11c7ae8297c12260805461ce65b68f44
BLAKE2b-256 e28007e9c9b85d830bfd1f94a1c72b665c0890171947f8ca5d2d94fa5e7e7dcf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b3cc9c8a3940875f67d61a15008746870a314057d857c6b3c3a4b7715d17cc84
MD5 8596c3ed37794e0b7b3759cbefd48f71
BLAKE2b-256 1d520e641904c032c200b7ac17e7a19c1fc3fa17742cb4877b5400609627e250

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27f8b08a148597a1cc15386128cbba874344d507b1599dc278857677ebb379d6
MD5 847adc5850d9f06973233fa592b0445e
BLAKE2b-256 3b5b78e203a560a644ac9b0e2d796c15f447728c822d8c025a0b8d155407aaab

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e3cca2edb37a5350d6fbc8594a7eb65ff8b1eae206b615b5b8148f6cde4e714e
MD5 a63bc632203c81ab26434a38945e7f67
BLAKE2b-256 074600419ec1ccdfcc4da3a2394bbee4992484afa892753faba2db2f24aa0f99

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 67154b4498026809b3ba915fd23fcd4215c1acf3f70e74331a5b067fce5b32a0
MD5 00315eeed3df0d5a5a49154f7209e56e
BLAKE2b-256 3ef454a2ef4057cfd1a6cd078b1f880adffcc166722f24e725df860c5706a250

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b8eb334b51d0fe0cd559fa6df14e104b2128991c798c6241dab1b2a92413aad6
MD5 a5c99181b7a4e7ec82667c8a0dc68bdd
BLAKE2b-256 0a85f4d7e87d2220fbd2c47e426873f42d3706822a13c7a594b4eeea6aeae21d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d4e15339c7a612b4cfb8d1762ee5abc7114c1c449e283c39c5043bdf056b74a4
MD5 fe0f6754f127dc172ce562b25e0dd00c
BLAKE2b-256 a69b0f04448b02f7a702cea972cb755247feb283716973326d93ced93c600a4c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 600f5eccee6b5cf8e523db1319271d33c269599608561735815be1f516da6bce
MD5 dc42747c11e1407c2513c02c52d7fc0d
BLAKE2b-256 89554772fa2fbb9d554ef3014969f9a68558274f0277e1495624efec26309b56

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501071731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a9ab2d80a31ec6d0015c097ab5c41c4acd68fd5da616da92e978de88bb0b2ea3
MD5 3a063e02d87318766a330fd3210a94fb
BLAKE2b-256 c1bd8fbaf62a118667be5935198abd5ee29e6e8e6da75094b160e8c99ff67ce2

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