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,2023 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.13.1.dev202404281713370971-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 557f50a414381639a85a41e0280aec51d4d5a466b8db793c4fd15ae31a87ac59
MD5 8ee79fc527f3dfe3f8bf1d703dc99e0a
BLAKE2b-256 d5b9a72832878af630b7b1471a060ded74f98fbfb6368e71796557be555aa066

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 87f263b557892ef9c01ed88e9eecfe3e9744652c42ad38e836ffd074d5c0a9f8
MD5 597788722112480659c3a4a85eb40243
BLAKE2b-256 01a8c828a153aa25239bdd2a9147ca34cb36b4af0a245ec3397ee7c801a03f70

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0032ba63206808c2daad38b0a85cf0f782d302d9650c7d4ff2d87c9bc423c6b8
MD5 3eaf7aaa5ff2f2f9bb47a897b029c281
BLAKE2b-256 959dd8684ec3b15cbbc5f862575d8ba6778ac8269ebb2aa06b9be066fa8e1e1f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a0a41e6b4e1256870b3fed140fbfb89a93b0bf76699902579e8a1501c0f9420
MD5 157fb6af84093728ff101bbed4733a8b
BLAKE2b-256 0523a4d5143cfe7c3d6d54eaa6e8aa28d2407739a00141a6d2de088463f10ca0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c7d3785d1d957ceec8b917e247ed0243bfdbd92656eec323641543d571c995f3
MD5 f021efa7be376547d1c43eccbac82eed
BLAKE2b-256 612a3d6863b30c0d240684039e74dca077084c4dc504bcb49c0654cc99b4441f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 95f141af97ddff70f41d045258b1d6f1a7fd3794b199721da9c72abcdc80a4c4
MD5 7cbaffa24b24548082e61e06d24098db
BLAKE2b-256 1a6f1d9a69d9254227961ff78ee58fdd628cf62cc80bfd605f50b591704dc280

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 15b44b74e7434a650520271bdf5359f1297d67e11768b819ee4d70d88054743b
MD5 1b532f919269d4c61142d7a0dd254644
BLAKE2b-256 aab8e86f5b47f0863ac0e72f40b94006b996316c1f06644a6dff7156f6896af7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4d11ab794205594529a2f51c8cd5346c7af9a1610e80446e4dfe02fffc1dcd7d
MD5 b5b1c5cad14bd1fb7ff1ff666bd0f61a
BLAKE2b-256 997ec71b8bdc73e90204f3246712cb4327af3d9e12893967261c47319ab74f71

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f814a0926d7c72f2d5ec0d06e78e0087e7d10d452ca66a5a2ef411380df396f
MD5 a5aea8ae0bc0530a632757851279b71c
BLAKE2b-256 dab2aa89893259ab23afc24fbde83353cf89618dcc8d9bb5a34d433e04e54cb6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 50e855cf05fad3754f8bdd81cc63efea18647ca94e25b44ceab228b56ef51d69
MD5 f7b12460b96287582a1911dc07918883
BLAKE2b-256 136af492f39b32417f8da0fcaefb6e9a4a92b61df2b3432e7eb12758e8c4bd58

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 aac05d20e54a1e3771c881404ec8dcf280483b3a398139a08fe4d0a5ef2de0ea
MD5 c4ee0152ae72461eee5a1e3877f8883f
BLAKE2b-256 99d99840384b2c5c4ed2c64aca602bde952bff7cf2b2fb60398a048f48301789

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e5feb85b673ba3178c84281677b6b238c68fe2e5b01c0c06562bb41e8c8f3a7
MD5 80a4c54d870aa85265ac2a9c7a5d3595
BLAKE2b-256 f8865133e0289ff4fb535a785986ff20be2095ed2b2582ea1d5df5082f10bca9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 58da155cb2c205361f5a551cb1c66d6f5b5ff33d511fd3d6dbf41e4a8506d341
MD5 5eea5245a1409c3cd35546b2a74887ef
BLAKE2b-256 1e6e4f078c03906090a1f55fb8db4a70efe749bff699e994a65d74189ca17dfc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 97b47e73325fa9897bc3b320ebbbd7db012fb8a2f24134bd7985b08411ce8c22
MD5 f95dd6f02acc88448117d5a3b7bc63b9
BLAKE2b-256 dda75d08ceb27986b05b7d971790199f01e0705edfc0f95959e5e15c83fb14e8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ca61bf27a9bd506cfa9392602791d0d20a9c43fa724eb5e4e02c4ae84ad0aeab
MD5 f32e6530c269f39091ce7bd8900519f8
BLAKE2b-256 e99953842048a44bdc3cd7aed044499e5a8416e8a9cc51befe8f9373eb2d36ee

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3fd18631c9767f47881edb9461f94ae483f29381d8a5a8417f033228af8f373c
MD5 1646dc30bc4529ca5fe3f116abb2c058
BLAKE2b-256 1ac6eae69861886917778db446ccb503285a3f7d7c18d6490791d9d8dce92d26

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 90a7fbaf357b0c0d9248e379d1b2e372b93c13ebf4f6bf907c0b515127cb74ff
MD5 488b98764c5feea94adcebf4fda9475b
BLAKE2b-256 1eaee53b96ea323c937d1769ad33c810057ede1d2d564f7db5bf26f39c848201

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4ae080054643fb1f4b92e31ca5a10c9ebe6baca3ee53b0ece97446b1b775bf00
MD5 79a1e47e44235fd24e40e596547809d6
BLAKE2b-256 6f0880472446ca9cdb30df92a95fd5d0156d7267d4bd26395ae0b59092d7d04a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7627302745ce962fbaf50c0ad0e56b78d4a79c230d89a07a3eaf0ff039c52ac9
MD5 504f630c297404846566bde43ba70317
BLAKE2b-256 d4e06911818fb200a2c77dc1f1c01e8215d92fbaaef5e1c1f57fa60dc5423279

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7a5378a30858f2534cd268b358abec7d90221b662429defe709226b71f39eaf7
MD5 aa22f33c305050b89d728de76ba28a74
BLAKE2b-256 692e172d48fae10a4e18003671397294fc705772dde080b5c9b5e39db0d92a65

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7dc8c1f1e778f567727225a402abb758d9ec3195e298f7f0c434a58810c325e8
MD5 74f257b391ae1d934b5a31d8ed60b6f8
BLAKE2b-256 f383652a97338342de8c22bf7ef9de08431b1394c01b47339e33ebcb9785e180

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e90c390278c77c7a95c212f89715cc5f49479ce2f766a880b3c4d9e9ef2e8663
MD5 a3a5b92019e467bd4da35dd1b56fbf2b
BLAKE2b-256 1724e426ec732968473a6de0fa4b9098a67a87b8544e332429fa047d043d240a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9e2623b60a00fd4a097263a4c602cd754c482d6808f2ee17a44b12bc78b8989c
MD5 dc412b28d7251465a8eebf51fd76f83e
BLAKE2b-256 f48a38ad83539f336f0059ffd7b82b197e9e2f92bf6467786e6bd33b6ed70b31

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eea3c7b322b7f44e8c3e4bd9527174629040b210b18030563dfed4c1dc208a2a
MD5 38d84591b7bad125a6143b3acf7e1289
BLAKE2b-256 8e70deec1bf029c1b5d5d80c5fe97d22a677402bddf8dadb0da8384588a6069b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202404281713370971-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0d94d4e8d856bc4e66819f2d6fa0257f50b4702686e813780c4a20b9a93cf261
MD5 e7aff7cbfcb04b79335e4b30900a4855
BLAKE2b-256 38482751beadb141a07f68c111be54e4bba033818cc4acefc93aca4e987d65f2

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