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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406081715182293-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.2.9.dev202406081715182293-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202406081715182293-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.2.9.dev202406081715182293-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6d721f5092be2fd250d07625e7beea1dbf631043e2e5d6ecf663dae21651ebb4
MD5 a80654e524ef793bfeee6ae6e20fa5ba
BLAKE2b-256 48f384cea8da5f44a03b6c48b1c205b240102c9fc6e73250f842060aefa07dff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 79e839fd6a0c980c026484635879dd19265a7bb285ad9f935e27d2eaa68a7a42
MD5 09697db95016c89e1153d470667ab485
BLAKE2b-256 e552e7a72ef2d4724366b54624b942c3e60c9cb0721ead8453a07e032c0cb654

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7db6b901e853e604ec56b7b2ed90abdd59ac1f3d191080af0a3a1a5886892f7f
MD5 cad53707e004cbc9b35bfabc1f55c8a1
BLAKE2b-256 4457bb712289a52bd40c3bcaa4e451b27f4c3ae654c2227988574d17d55c8635

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3897eb01e527c52b2c52a34c363834d638f180cd1db02a5b9189ae120723ca82
MD5 349bee9415f5befaa4f5e352ededcc45
BLAKE2b-256 b617c4255b6797cb4a964ec969ba93592db27a732e800f8b3c1e8ea632181f0c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a16676e594df8a5c71094c298107fd794ddf81a7d606ad2e03164c6124acf704
MD5 6f4f2894692f82c2ef1e96cb0fc591e1
BLAKE2b-256 2f7dcacd15b0c26ebabc611dc13d6ab914e7f0c31388433e23f0d81ce5df3cc1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6794ad399108818ea90c79bec61f74e41dea06e10b1329a9fffc848d4781e0bd
MD5 ea63bcdd7b18faeedfbc5c203620d3ca
BLAKE2b-256 d323cf3f1da85b70113cec4c858354181a0584d8607067e494df80d52c23ff71

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ae7decec3488781cd5f240256b582ff5a2fd8503be8cc6839e620f938e3b23d
MD5 d9834d6d5e9d5c542e502abbba66b31e
BLAKE2b-256 c8c13c5212b9760b30f6373bb0c82632cb3d68f42e6d35591132bad939666d6c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 56eaf8d2539456beccb5a0c7d5a48e99fef18518238df508f27e3f356caaed4d
MD5 ebedadf262e7b264311ca218802676f1
BLAKE2b-256 a7f573c73bea0928693ff8594b252f7fd6322c7d22e1fc5a9fe84ce6b5db2623

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43224995f943d6b5c831c860ea13a5aee66d052ad43a7c57d5823afef9c4b3fc
MD5 eca29d62371617d3924a498e06fc2011
BLAKE2b-256 e1b9404b3abca2ef5b314498cae8ce56417c0081e740f80fdc37119d04e9e482

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e4afe533cfef98ebcfa5d1f051fe090ba1846ae8001b79d2213683022e870ce1
MD5 b69f248f3eec115f4462a0ad5b20cf4c
BLAKE2b-256 a27fbdd5033cf8f1977af4e2d49cb696826bfe945937d5933f33ede4379eac47

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8cbaa41a1928901a5b457dcdd76eaee28b21a99e79daf86bb1d8cfd1fbad7ca1
MD5 4ece16eeac67fb418ecdaad23997857a
BLAKE2b-256 903fadb0f7e634187085fd4b9cb1d34e25c5fb340684ba92caeeb02f9dfd78f0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5be6b4486b238443bc88b404d798563cd0fd8eb06deda7f9831d03822c3e3a44
MD5 a3b4450e9258c1ac4f10a71eddb6f3ce
BLAKE2b-256 cb8a73368944ba6a8f49a6baeb9bf329bfeeab23e5838d179b5fe13449a29e13

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bd1d0d57258a92b987ec4de6d1ade45ec341edb2f5123798406104dd37a7183e
MD5 c05ac775bdc8f6cc05c7a098ef51b5bd
BLAKE2b-256 377c17938f1bdb8c356ab92e1276d5be5f33a5101f75891f47573e9e44309344

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 713e004064d9ee00f40b662f1de3568af7db5137c10c3db2e2a679343750cdce
MD5 74c1b47e2e894d4471977199a8bf5e29
BLAKE2b-256 828fa3bbef3b2d6e75b75b7d9517613f84960b6da69185a6d962e4b6a56b4b9e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 35e386ecd7f7f5c374f82767ac4d3f1fb2098c9b3893a4006469bc3a4113a287
MD5 b7c8fd9d02768db7d3343de379ac6a1c
BLAKE2b-256 90f8e54fd8b73ee667b8b57ec2c1cbbbe8acac65a1d9382f5697f9ef122cd834

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5452ac8e48f7009a038afd04cb65aef54ace8b111970c23580cfdab238428740
MD5 e6ed7c76aba661c5a9c8293c87f4f8a6
BLAKE2b-256 179659bc8cc337dd121a43087b151bf66d92a9b163e5a6d008fc1ab6d02cc772

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 02eca18115809647564db0583dd0b79939949604584c8cc6978878f4919c4fdd
MD5 1c55fea6e65597e17ed20945022383b6
BLAKE2b-256 4825fcac33774f290633d267fc811450affa3ab5863ecda0db883ccab5ef3a81

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f5df01ac92429b78aeca76c8f96b664771a56cc4abfded3af1b93364b4fd942e
MD5 68d0bbdb05d1471c4746941d03646aca
BLAKE2b-256 4c6c0ffc028fae06ae0a8846ce8c75485bca06cae3e76c7a4d7b343ce22f7c46

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 709e8d0074f581248b86b3224cdb7b1dfb420eaee66bb3352c65161fe5568b68
MD5 beeadc47196cf58b98ba1a5edfcd1bd8
BLAKE2b-256 efe5969aa4aea6a1f9436d680f5f2851fb78358f5f69f26719c95379a47852d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 facd51d309c42213b710362656ee88612b70fc2b9e0cbd868b19142916741e42
MD5 7fc50e5d01e494494364e096e0d77ca4
BLAKE2b-256 153db9c1b66ff5c5a341ad310f89cbf7a00068d5865bf0c571921c4142db05df

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4f78e190765c6a001d03f1de38ddb2835d029ef220f17f73041f2fc873b1a44e
MD5 f35455af78c12c5e021a6c87f080c6f8
BLAKE2b-256 08c51c4ce04991bb801dbd8c1fce3a557696e89f6445285d0f38eb41139b5d51

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aeb33ae0ee525d5f0490192ee7122398ed5b5fe667b7e10cf26dc3b76156c53c
MD5 d23c0e2152100795755e4fa9f9b1298d
BLAKE2b-256 beff12e6430bcb60fbc72ab4a4b9483e6cf00bca9d5515e7370dcc5f18132d1d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 22c944b3fbc8f7068355080c537abba56e7c3ef68a2c2adf5ac2a9853e38823a
MD5 7945f778929e016e6d4c0cd94789f3ca
BLAKE2b-256 7f76cdee2890b90f56d1d998ecf8f2e15af9380719ac7e043f8d569a74fdb0f9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 25ea08c1ebc5797eaef28727857fc23835e872f0aba5e4f0ff56ee69a7092799
MD5 10aef2092d51ba88aec5f5f4f98679dc
BLAKE2b-256 1bc5892dc7b7b3157f6c8ec775a0d62d5aecf1be3319a05293e213104785611b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202406081715182293-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e0114e9d8703cb084254da93a9c3d63dc2a12ce32df40b1b1a9aa161490728cb
MD5 c7cc7d4507e842ef4d62e8c2a963cc40
BLAKE2b-256 73359ad7aab7ca77e42c42db4ebb84978dfa9492820c1571a90c0736abb753cb

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