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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f205d31acbfe1e7029d6ae24f60a5e80d340917ede0b3e308730e3b0cc4a4c02
MD5 8ef4b1013d6c2f8390a5756eb11825f0
BLAKE2b-256 cdd857c1147a56400e2c39cb9302b7519220a3981859d7a73bd0c29d5292c0c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ceef3fb337efa3ba0110a7c8e0ce5aaf96b0b79c57c1fa779371dac50f3a539
MD5 3de31a1e636a1d1c4e70f7e9553989da
BLAKE2b-256 4ddfec85b6a95615937d4c3aadfd36cdc272a0e6b2c15c324841cb8091d6ba9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9f899cfff1f92bea24dfef553c2a303bf0a60bb747a74f84368e26de689862ef
MD5 4f658abdc2dbd08e8e388e0146a475ea
BLAKE2b-256 24d6fa29de4efd01d7a6af66ff891851fadbe5d133ab2f124ae6a34ab16f902b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bb477bbec492ed3543bc4062b5e27e3a950c45d26a050ea85ec80a7125652e1
MD5 434a4121129a430779e3eaab285dc7b7
BLAKE2b-256 a74ed02b2e146ba6e70438ae4e03d494acc94daed7ed2dcf2d958506a441b444

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b9896c546ee66bd3081cd1a455a852145c5f5fae969854e963c22d49f46924bc
MD5 62a97a61fbdc6c8c534dc4743cdc1592
BLAKE2b-256 c4781dee873446dbbb89dcde891be82a1110a13218e629212dfc585083d6dcfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3a7e679dce3b9d3eb3fbcab3068bece48e8acb34a56b770247ba7eaeeebae9f6
MD5 a096a98073c47a8dc0bc3c3e9e2394ad
BLAKE2b-256 fd024910538067301fcec3a5192e417c173b956768612b12be597b0d7e1ee755

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4aaf68ff170d7a7d7e456b4d4f8aea6abd8ccf61a529584547f7e2b02057c20b
MD5 369b3da97001599572e72ce997c76088
BLAKE2b-256 93a9571f78dc0ae7272f3b5e2bdf043580e856a767353224ade827ad69c5cf95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 be5edf102d9588dd721548ffbf4bd3ec533ba117fc9097b5cb49006278031d24
MD5 e469c3c0c96053e8233ca409c7d20c01
BLAKE2b-256 4f2975dda8c9c681d6b0bebf8750c2d9abcca44a40784695741d0e2dfe08e1fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3456a33c3e2da3868fd08784323a10ab8bbcd909044adb8296376a84b016680d
MD5 deea66e616124e04962daf081a3274c5
BLAKE2b-256 43f426c061f44e1b473e97356d14a420c995687c669c4061067b3533e6cc8ac0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 29d55636401983ea2c6200814472b871608ae16578e69e8d8e098461d146424d
MD5 1d84790fd2e951e53303a57aefc77a5d
BLAKE2b-256 8c77994682c7121a554618549990a91c800ecf3174c9fc4eb10f61332126db58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 984cdb00589c9ed7b0e77534b42ce7f6398c910b270317e57de76eea590921c9
MD5 a6b35c80eb465a1cd0a6f285fd51b397
BLAKE2b-256 e4574f847a2daf40dc68f31f73f5b72ffc00ef9ad4ccac1c1c3b684a8a84e30f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d5eee92824393e639b3099af97acf2f1e89043fcce6910e9556d680dc9721817
MD5 3651f323691c2ecdc9790b9b44d3bcc1
BLAKE2b-256 c42d588fe380e1be8c47488c5c40981f9b4daa8469b747c2edb04b13fd553470

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f7464fd997d16e23c4d9324cdcfe1ba4f4a71c7d81e9fa0b7f8eb5d93572380a
MD5 46e52da67df657796563a3bdbb68d314
BLAKE2b-256 828a8c4ae8eb91478b274c7f1d240d340b6817007368e8c8b54c76cf5e8ba1a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 314a737d0f284e667c979c35148be0459fea61e5a50c20e8f94ab5ce44315216
MD5 32544f755b24690055af21f36aa8c931
BLAKE2b-256 e10e5cc8c49620f984e123ff929a2a6dcfbee84bfafcf1a9a3932a59b0662c5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 99db47aaec42a2776663b79d331a4e8bee636b396b3163482066be1efc6fcb39
MD5 c5b7832a512b0934f5d5e83b5758f99f
BLAKE2b-256 42c5344c36627e66ff09965f50622617bac15ba60208268a2c718d145cb1f7ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 46cefb2d9882e085aa2be0f4ca82ada03945fd3885dd3f289a5e13141da5178c
MD5 1f7c955121d914249a2a0b7b5d892961
BLAKE2b-256 b360ebd7adac2403aadd12df40db0c819065730f59bd308c15de8c94bfbdaa03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c340ecf9b189250260487a6029ed7b08404bec22778d38adaa3b7770c848add
MD5 2e65125513066e26b9c82db26b9972b5
BLAKE2b-256 ec25f1e898eecd004878e12c8ac8a2f61f35da68fc3ce2adacaeb5ba289ff7ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8bf25285851b015a932c7459d8f0eaa150babb84ca58f58082b8e473e1e87082
MD5 915de989b5fcd6a423aa65f1c8032d51
BLAKE2b-256 8718cd5f7979c4402a98b54d6e98e1033b0ff61a9efbd10c894c870df78172ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f5d6dd3699b03d2f84882766642c7b9c15b304d73d0de311023a8b2a3e719c4
MD5 02649cb6fc725de9b1590f6463b8cd5e
BLAKE2b-256 ab3424163e27a160b4032166b34ceda861b0e810d120fe8759a0a258c7f57acd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412291731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 16f60f78dd195e12b18c10ce1c483df1400da8e095f94fd1cc94d51db98c2d8b
MD5 8929ecf4cae3b4f683c4d235ce2afed5
BLAKE2b-256 420643f670a63033c0b3288995d0e8f6fa90d891b8e41b1d4ba9e13178a5df6f

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