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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b51f52a5c1e92e81357a9c6673a537cd0253da3c842726fb774e647a5d6af613
MD5 4bebbbb7ca8eca4e850deafac1a9ac13
BLAKE2b-256 d1055e3289059b65d1511c7da68badcf23197fbbb4bcf96649ff7d7a933dff86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2955d52c8630668e5fca469f0f6da4ea2f23b2594a1d204c27d12e76413fa94f
MD5 1cfff7bf58bc304031f3074a7024a728
BLAKE2b-256 24a50b84c37fa83af104132257a9003a672a7eda9792334b051dfc692ef30f6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c6e73eafd2c305786858eb23c1427fdb7a22d9079f9574a1ea543d22eeb1ca2f
MD5 7dab396377507bd6787ec0fa5c3347eb
BLAKE2b-256 6cdc1aef40761ebe859c52223ff90b91340d20a34a4d97230fe140872a43bced

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50db0f5ac61738394c62b3a28d6cc25625b133ca45df2e630208327f185acfa9
MD5 d7de09460b5343e980b1e80d67b26e4c
BLAKE2b-256 432cfc5a424613fe9dfc77c026263b3c8d605920de860246ff1341eb3bfe8709

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 7b25bf65098aecdbcf49d56812a9f8a5b60c43bd8e7bbb6342752665e1cbbd27
MD5 9c96d4b7174e8996a51f9a8b098223e1
BLAKE2b-256 8093b80bcdc36d223bccdb42b313eb53a8f9d8860081b46b9939318024cd6e1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6e25babcd0c34d6b5bfaf257dec6fe5bc44f910f257c01cad2bd676dbfa1d6a8
MD5 6360b704c31c6bec38f6bf5969ff807e
BLAKE2b-256 713db03c173edb5284d12e896c83e99693924206fe1608eec2ed1dd5a6acf4ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3e3c1fe6bc13b006272135c1458365099231dd2e08546059aa129d3e9f77e1d1
MD5 df96f3691b9570bd5132c96a05345614
BLAKE2b-256 858c21ddf970ad08f2e9a4dd33d42ea060feb18db42f0aad3e469d350b553086

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d9e57ff1a250112a2a44a62ce1ecf9a5c9ca4e5a41566192df728c69ae075820
MD5 95c1847b5407fd142365d7ea2d561975
BLAKE2b-256 a35f2b813ae95ab1e32e9334a8777bcb7743711356fff8cbd518804aa256388a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8309271d4b2d70cefa4b77a0140749fd548ce1600eec2bcb7219c91876b0da4d
MD5 8e2261eb9cf18c4d9da39d9b9a38e2f7
BLAKE2b-256 e057d5786f746936101dccb193d000e197afa75d1590d7fe1060335f81e9e64c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 da96cbc11dada78fb7f9cbf32f0e79ae5c5287675d899d163964aea3555bc57a
MD5 89f821c77b8f61cab7de01511e646371
BLAKE2b-256 61b80f7289da3304f07d9d431b86e5051b6b21848a3255ae585ed0c8d205b80d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4b71bc34ec7ee0fdb1bcbefb162f3ce29fe0794d432a904bab6a0594ba4f55c1
MD5 40a3f8914f27c7079cce7e5c20c14ec0
BLAKE2b-256 74ed9667b9a4847bf8e71e2664dc3aec4f8b98da956ae39452dac4d6383a9bae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c8c0aca40095bd5e1a1f813debac2873b673ac29c6c122794f1b12a9d284a71
MD5 d6419ed76de66a47249a3eb58ed54b28
BLAKE2b-256 234d0170470f6e83e3f41141a21f572e1ee1bc42d443d62777c7731de3d4e8e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b2cfdd664ca9dd572f2f29f7fd316104e2d3dd8097649746a815ff32e51d9149
MD5 a6eb3ff087d015a5b4220157bca743ee
BLAKE2b-256 c4a74ee3a74cc7ff42ea5cb4129357159600ebd4c6721a691d13d33330a05cf1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 385d8e4349dd2b33f4ab9417c399085f1b288f64291ae79382c236bc88396067
MD5 a28ad12c5735c3eb89510de7c4058a68
BLAKE2b-256 ab7a24f2e3c332887d9cf050eecac8f6cf4b11e6a9e9e8699e8aa260ed800ed1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 14363f2ba3c8408b2be02954d1b7adacd52321cf654e8d10ba3dde68f8c18f06
MD5 baefd28a62914deeca9eeb6040e414a5
BLAKE2b-256 d3dbdcfbb0c388dadaf764aa4362ca5e7b51eb22e5e3a9a26fc02d42875bc696

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fccfc080225e6dffca2285377cbccfeff9f783ea20f9f59854bd64215a5d8a3e
MD5 98599c3b1df126e4c8dbc15e89d77b91
BLAKE2b-256 e400a4a1d0695973eb5600b1b66ec31535c79409654706f1ff8b047aa7b4e087

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9012d0c409152420ed83302994a82d4d8adb88d47b088c1579d85d3713ba24de
MD5 cee75f05ecb87d50a1f92651dc4a2f36
BLAKE2b-256 c2e72a4ee7ced628de876fe7fcb7e0c8aa776bd04628a9c786bc7931e8e9aa54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2852c70b739f831a797e922681eb638f3a63b8907b5b286625a96c6454667a1b
MD5 2bd26c5308bf266d650291b88950a66e
BLAKE2b-256 9d0b61fa56bcc6272fc84360df9c331d94bc18316a5dc0cf4464aa560c373219

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 166d7163cb50a37f0777b62eab931ae7f003f9e3da9abb77ed16fee0134eab5d
MD5 3e8d7243c62e5e14634058b88fc82ef4
BLAKE2b-256 36ba16d549391002ab275842ba695ae970e8bfb9df0602881b2a2228f2d407fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412301731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 debf6c2f9afdb362f4f241811e9edc97f22e0f45a62f5f0ba1a5c6d9eb73ace5
MD5 407da64e28147bc223f1c86f0049f3a6
BLAKE2b-256 24148beb4bdbcf455bb2d52f356694185b8f78a6f0e34cca192b1703f7e3df00

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