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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 378d6df12be23eb483790815cd73ff42d32d95e32fad02ddda48f5330700d1ed
MD5 ab737cfd82906519138161cdd87b01b6
BLAKE2b-256 15c7974a22d93c8ce640e9aa4c4a07df34e261713b1c99e9b57d7060d3e82a78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1bec78b72d7c8a18e5e9d215958d9efc291c325314555e8a0ab9ea1503ab865e
MD5 a6a1050ba067445e19ccd3b535c92998
BLAKE2b-256 4a77bdd7ff8a1e7ce71e2608adc88fdf1170e050304831aa0a90c8fbf5f06329

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5107f2799d99ef0618f29fb9d34edba2503a4f6cdb50c6c7f103b2d04c53294a
MD5 2bb6476a3e2fc74b7602257ab28c2b92
BLAKE2b-256 fe8c0ead7be7daf9a4682eb9d75d3da8852c7821aa932967206657ea5b3cd5de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0e915887c3b136672b956007ab29438771f4af54d910cf50c3ab7947a9533c61
MD5 5e78fb96db71ca4f23fed92612533c91
BLAKE2b-256 e1f5987223b873f7284d4f92478dd4128d79962540ce77e20ca4b18be329db54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8d20036ed5239d05bf21a9e9aa07010ef4ef342d8fd0aa075a0c6afc71737aa6
MD5 7be94c4893a5fd237e4adffdc8cedbc8
BLAKE2b-256 341d946b4cad9647683b74f366a1a913c43d6f5c1d95f6d2ef446140329bd644

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5a5422072c3d24cbe2e2742c12c78e8a4eb2c429087228f3448f7c620ef8fa50
MD5 515061c3be27b600765e3d171737711d
BLAKE2b-256 5a3061f0cd82f556c0867606247877df3cd26bc26c540645ff84800f3922da7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e5a9d65959456726fc8a381ab9ee743f95942a41c710dee9eea6853c3323aed
MD5 956be5598db07dbb8200a68292feb66d
BLAKE2b-256 70d2db890486b45dd287e0024f26dc88472ff820295be24f701fc042772e812d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 29873761a8b3813ad5c1a34aab5c1e5398edb5747713b4cc95dfc996ac8fa4e7
MD5 cec694cf3f3a10ec92f9239a5ede5d42
BLAKE2b-256 3c57b9f498b4e0a888a3e5be926797fbbcabfff6f6810da8d39d27ecc1b8ade8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 646979b9300dd920f6432b3d91c9c66b93780d5d826450013947abdeab896d17
MD5 231365dca1332684465c21f6ba7e2cb6
BLAKE2b-256 34dd1d745996cb2f60ed85e232cb4643f679a6505fd75aa3b94c2dba239f4bbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9d27bc8fffa9520d2f2fe6b3f83777fa393c399c8dc860fd0bd5833d1f63efab
MD5 df32b24c95cf31640469535c5e50eb5f
BLAKE2b-256 d92eab9ba3c2182c460ef4695fd9a25ea3ad7b05a424b7ca62c87fb7d6b874a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5c55f5f5c65fc51a95af8eb451adb4a8529ab7b45fa968a068decf2b630bc75d
MD5 5d47a6e17edd054d2c2740dcd8d068ad
BLAKE2b-256 2474fd5bf16ea3d0069d986d41ce40e0fc30c0342bd8fe23aef657653ec63407

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 715160785661dda3e7b4e2bb5a42457ac765b98f703cb4be70e8af34c0a4c3e8
MD5 83f456cf4572d54ba8e39ce96ed0b57a
BLAKE2b-256 0c60cf4266f8aea63bf68f1248141df5a2ee1d92c07f6e732fb23f8d09c29520

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 795ac8c6ab56ea485bc15b596aa6e402881a816c096253b2fadd133bcc920d3d
MD5 3652115fd6cee484877e771b5d549fad
BLAKE2b-256 1667746a8dbeaa81c7ac456fee5fa3df37b99a6d4f5071c88cf544df5aa76f64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 176aa2513142efd35ab1764104da385e44b89e3a5e02558dd1ba176b27adaba7
MD5 dac6f33d255cd4db3b4b94136829c84d
BLAKE2b-256 cfb811421cb710a77d7531229393abe4cff36a48d092be927414d65d547166ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c8ba6d2ceffe7b8b38ab008b3590dbb460fca6dcb185b474657cd166637462d7
MD5 c6091ae2079502d44074d5813cd34fca
BLAKE2b-256 13faec5e364bc2fda6e2fd14e3260dc0607b455c6c786a393009dbcf3dc6253d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8487293bdddda23e01fa272f305ece98d83db0fca57dc7cdd0257df8616e790e
MD5 8c978839ef1757ec5e3404506fb386bb
BLAKE2b-256 0e680bc73816641ef4649f6c54836ec37d70e959ce14b6e762d05ebedc0e19e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 336a5fdc443da218ef6b27345ef6a2fbbcd0ee51782466b2b59f61b99a632443
MD5 62fb649f365054e121f6198bba4791c5
BLAKE2b-256 a3c91ee147347d8188b8c067f29721f361e51a0a533b79993906fdf7c8e8a4a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f81c93b92e539a1b875ba7fc00131a4c38190ad1721321f469e8af55448fc811
MD5 657920fa1b6ca2523d05576dd161b891
BLAKE2b-256 51dc887d243eb807a8a4c6636b2db3738cd6a5a57822d97946d43ce168e1c52e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ec333770da4c8451566ab07f11bedd9f8f500fa4d2906e4eab940e262874a55
MD5 f779bc2afb4879350d778906afb75f59
BLAKE2b-256 bb3dddab5c51dc997351b13dc502408956695e9d33d7198038b82952c4942b91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501271731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6e301e99dff91a43967183f7ebdf42b09f7237c0217018e9e219964ac028e608
MD5 920f4d594a01d5748106f955e3bf810e
BLAKE2b-256 3624188bab92171aac2fe2662f8a5e2d8fa3d274d8b930fdf3a4732720cb8c08

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