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.14.0.9.dev202406131718113029-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 724ab4f519a9e13f491ac5c895b1bd9d9750b41ca8dbd392e0b78a692d3d584f
MD5 e212530274ffd9ff271501d31a15dd8c
BLAKE2b-256 1ba2de27ef33584eab219f628fa3ab5712e6fb91972381f06eacb453202b845a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4aa04285d68e510a29f77fd80672626470d6733195ba18b0f449808e5380ad74
MD5 ae52fe6ebd8e3cf87ecc014c3f404427
BLAKE2b-256 be292b66a01a891555aea744e91acdcf3193e37d8cc1d287b8781dec44c572ae

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 791ccce2416a2fca31fcb89367b7ca9d8ee84fb4c78c0ce057866690a69a4273
MD5 ebc4cfadd9d6fa9894395856827279fb
BLAKE2b-256 b85c6d60afcc156eb4eefe93d28066658462582bc5bb5fa2fcfab5b3215af507

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1b373457b8cfdd9914c9a385a74398cde3a943d1854e103560e9f417a58e6397
MD5 adb68ba48c563cd45a70d914e9b2b099
BLAKE2b-256 c8e9f99ac90ff3cccb8de8fa7c3944e45a7b64bf71b4d1433ead3a25c360c0c2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 252a6d31f5500f69ec4842b058f27a54846be27f81dccf7ae1ec2e7987aa4bc4
MD5 533de6a95a0adf104b5aefce6b936eba
BLAKE2b-256 e25f0ea277c699d2a8ece3dfb623f81f28469289ce07e2fc48b20f64c3bfad0c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3026e1a2301322e2567c9fa147a5415355adfcaebad91462943ae305297ab52a
MD5 1196c96191b1eb487b406d068580ab99
BLAKE2b-256 8e1c58a8eebd2d9fc14bea84cd2f65b4a9e82784654fdc4d6ef050811370cfa5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d31f06c21f708f857e703c140d44900de42b0caacd361b413e24e5eee226d045
MD5 d25aeab4cb82ac072b0f02a8c57b72ff
BLAKE2b-256 5c211c2af85d0a46d852f1d0a65ef8548a48bbc6801859f76bf582b0e9e5a6ef

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b27bc734aea0d95aa7bc40c13d43428e80d9c9f8426381954038337285a9afa2
MD5 3cb8434d012f1c16cdd81aa0aa3e2336
BLAKE2b-256 d94564938828965ea1513ed4da4fa46562f229f80139015595236aca6a52b2c1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16683fb76a3f05d38a1e82855ad592710e03acc5631c06eb70d01acc8b38c121
MD5 324c1a8d9fcdf1d09100019b42c9c316
BLAKE2b-256 831ac41bd7d59a1169f4389655d57b774e5bef499045fe661e9fc1d58b854f0c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 687f8d051aca9181a087cf844e48a9c49cb4eacab0b78cfa267c44038d15b3e9
MD5 c043d12ad7dca8d451181da0803e8937
BLAKE2b-256 418ec178e8cec66429eb3928a4ea8dde859f338e56acc39257ac6240e3346bdf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 84c1b0a7902f42a2ce118034584620c298b20a24728d3ff51fcd930bf6f2ceee
MD5 6c7f393746869d30c16ad70024d2d712
BLAKE2b-256 6d8cb2461a73f08815a63665fe8ee5097f4713a2e9cb9b417e63f9b9c8f73f82

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a118a9c69324da1e69dbf5ae7881f9b314fa4b8babd09093b5c1b42d354c36fa
MD5 7512847158bca1d6c0852e8fdee6e00f
BLAKE2b-256 3b7e319a69ef3b6d51b9eeba7c528bb8390c95fc56a6b35f18864490efce679d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 700d331dcc11d2fdf11ee2559f1774e17cd58f3c23fe232ccb1d12015ec54fe6
MD5 9d0f22401e262c14fef41b3977c8affa
BLAKE2b-256 7459bd49f78bc156f46ecd02737bf7b4fced9d48f0ec433e58cf85f9315f4724

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f07c716ec41c1d295e81313e96be1f8a5e28d25221a69061216e07400cecc5c7
MD5 155cd45802bce30cc34a087ba6580db7
BLAKE2b-256 0536a07e9bcc9aa5805f61cbcd2cbc49666aa1c333c341b5e9d4163a5c8c9af4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cd7bcae01107cb2a69539e683b10aae5a66fec5de79d6bbdf25ac2c57f2f8d7f
MD5 6e45eb5dab310d5f08af948afa41a9d7
BLAKE2b-256 bde4f4bc8385b8b6d15ba285625fab0efbc074ee3d51e8c26d0a60aa0a8e6b85

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 563b720e1aa921a75960d7bac796f43e83cb16245e1d3e16f52adbd5196c5998
MD5 3e913ce81ff7e6c5184e2544352a0fad
BLAKE2b-256 831f069f1e6e752ced9843d7823f00d51e3e8584c73e3eea5032617208f82565

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b03c78d9d4e0d757238c97136ee352f8ceb5db41ea16a3cf1061c6f463016f34
MD5 9ef814c19878bfd7e3c2685d22f04f4b
BLAKE2b-256 b047abac430c980474ef204c8fa25a1062d8daaedf0b8995b142ced0b24819b7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8696b71988e3e4b6734f5b49e08c1913a42f0fedf6533cdeb18e62bb4a0f1c15
MD5 65df1b25a8ad79b71cd96fc4aa4d01f7
BLAKE2b-256 cf3df7e410003ca2d09d818b948286ba77f06aaa117ebe2c975d6db1be48cb53

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1129382129d577cbd0f4ed1d321095a7c5484f0c961fb985c89d567308e8efbf
MD5 1d9fa4dca4e7c7f70ac4a69021429e97
BLAKE2b-256 0b281cb527867857c5b8c4ed013ba76025a4cfbbbd4e55511f0e9e0662c2a567

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406131718113029-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4bffcdd8686dab11c084712cc48bed51fec82e895d6dce8874c1482a7e3d02f9
MD5 a704a66cc75d4e95add7c185c1f71c1b
BLAKE2b-256 f8a81f3e20193b02ae3f48b1efcd423ffee0a309c12e1686570372affe0d8224

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