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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 42e8bf76e5dec2b1f374a7f7977af7309fb38729c84f409fcb9ceef964a316f8
MD5 afdb444d74c41e39105ba74076c70dcf
BLAKE2b-256 7830f81ec3832c1e0bad1fed84eb4374d8dce5a3e334a3066a8d540e1255f2c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 37bca2d1a6eb4c6931c3b425394f90cf5fdec4ee798b99b1cf3c38518c9a41b3
MD5 131d0ee8e50335f85d6cdb8e38e26880
BLAKE2b-256 adb8ff1cff823e8f8cace0d1824f0e9cddb513c7b4b163340ba415e324c72f12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8f5df34710c0ac4d348a06ed8dd73013a3a71983de0f24e609cdd1591804d76f
MD5 1c3bf1d8fee12b4be71ff2b531396780
BLAKE2b-256 b811f906247bbc5ea3ae460ba0fbde7dcb31dbb7b75eb0dfe0b4d13abe088eb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 289960773539029104e9e28dc21a484eb5cb6a2c0849e09c44f973907f9c855d
MD5 2687ffec7a3237c28487e713d265118b
BLAKE2b-256 9c547d061b8d5cf14993862ea4894147edae920636777a930e8bd4e765749031

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 34b3f0c0a15518c7cf04168eaf557e869f69319022e22014ecc339e66978f580
MD5 ee53b7bbf608ed665715ecdc28d923a1
BLAKE2b-256 cae62b1b8dbd05ce1778b783fcbee98f7229b20e8262adde113ab332b12a83a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d12ed59ab96a37e7390a7b07c7abf7950435d9d67e781001e89f76f1224a6a04
MD5 6ae3eda41203a81161c431e2a1518e36
BLAKE2b-256 ee2f8c4c2537e1ed03d3455f629cc7a7827cd19651555fa774172371c0f48bb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b07824ceefd0fa1d2eb163a1cd63cea41cc08c1bb479d76a643f9604525ec8a
MD5 e3c3f32d09db5ae00b02186941a1a822
BLAKE2b-256 11373e4b99c1dbb4a48db8370478f980b25e190730d144618c394406225106bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bafa5056963708cfbc9fe8fd77af4957448b096e8e44e01007a848cb3beeea16
MD5 7a2ff42527b147047f733592bedadf92
BLAKE2b-256 9b95e0873d9462f7119116536f44180c28179b1bb75d43c474d657831471e2b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ccba6efbb0ec0dc824f863d16659d09950de9111b38e4b91d7a7e6498bcaa6c
MD5 59a8d5af05fe243cfab8f5950e8e4db6
BLAKE2b-256 8e61f082a80a457ad21ac24554c75f16235952c7a867df18f60676e39a3ee921

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b1a2b5f81d593425a8e78f59af781e3e15ff301a6ff03dc8f051062fcd260c33
MD5 0a0b7aad59b42796d4026cc0b7b539c9
BLAKE2b-256 460038bc1b1753bce70dd9cd5f82dcdc0b3a6226b3fa57db95be16c878340e55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5799596f3ff4feee8f8d2a7f71609dd0092cf3a71b9dd5e7d8c9108160d6fbf8
MD5 9a1a941642960124a446106c003de23c
BLAKE2b-256 a0ddb02d3b31290b8e465e8a15d82347b54f4816e398724bc3c7a9d86ac9f4b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 301589e236a9bbcf3963cba69149c2410f5d736153183d3806890d0989dcf881
MD5 f117542e643c0812f5e949d4b5887cb2
BLAKE2b-256 2218408b11b2773d88930ba49251add3f0052debe87feeb661d372f201f50252

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 86b671be27c1ee64114a54cca51a6e210f03882247b8cb7918b4d61dbe3b7b4b
MD5 b89ebb19509b5e902eda2675621b92cc
BLAKE2b-256 c664e4171ecc8f019f8f1033b3e9b57e7a563d944bb35487f1fe0cacc8f62b0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 794524e2317b5089b0f24fe5cbe3cb441509bbb2bcfc862ef12847017b64b68d
MD5 cb7a515802d0994f652df8a028e4cd84
BLAKE2b-256 50124d62eaf8395202b01db6515aca0b7ac54996ba10e6f37136f4d784e46882

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fdecaa3278596a19ee2ed476bf498e047a4b0511d798586bc884bd57f09cee2e
MD5 9b3f50ece79ac3279bff7717eff241d1
BLAKE2b-256 01a2c59e9b776f6bdca497b6c20abed929df5427091fce8d5ba3d3479931857e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6f084088d157f1798c0f9ade2a09ea0362852496f4fe352fe2d42d9cbbcc021d
MD5 4e21821c0b1d0dc9727afdb7c57a946d
BLAKE2b-256 6c8f59aab7fdf67c3d50ceaec6c6222c17accf5be84ce4df91be58c9e416d0c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f67093886221331a2bf8b9a8260a2e1315ee06245f0186217549740e5ac3fea0
MD5 9704983d4047c85c7162180f963aed87
BLAKE2b-256 1c747b6dbf7359defb38015cc6730e85db299423d07176f1c6b033ab7bbc209b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f4aaddcafaa8dc3d2445d3b06188257907cc40ef6f698ebc626934a144abeea3
MD5 da99be89d8ac1b3428c87e7d1ac3656d
BLAKE2b-256 8d5ea134328ac2c1e160f86f71c1ef990bbb17ca403a1b5dd7b50dd3be00b11b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c7cee7ee27203a84fceb7636f53b84209281714e5399bbc8f8e9f6951ca84259
MD5 dc959ae4e26c615c8414d7356ed7657b
BLAKE2b-256 ed13385d3838d2a9f572871f0806105b0ef6c86f8d5c6b34f4d8ec20c03ef3a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6f7953331a190e74889c8daaebb93a80688b50f54525b289a6f24bf7f44638b9
MD5 f46006e181ae71c9ee22d3969faf145f
BLAKE2b-256 d74e0925c7e155583d0c9a70636be760a782df0605c7c1857a5f04d42fe3d821

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 08ff3874d5be213c1fc94a247ff449068e6326785a3c82f41966add01983b5b1
MD5 59f26cf846d5afb248308219f56efaa3
BLAKE2b-256 c29be5557ae7c998a0e5bf8de2a3d20936fe1e8f5fab71e1cfd4457bfd86f28f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cadbd7fad0f6380ac6372b604c9d9620ebfbe810aea17e2600e51c177041f270
MD5 f13e9cb4d96b143aaf787080b3169478
BLAKE2b-256 75e1e6c2e24a172feefec6abb05aa12453e603ad0ee8efa39f64e99441f0e772

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2e8e7b7872147582ea3751c91e3405f7a0280534868d7191bf79bfac3b49dcd7
MD5 9b24613d804b782a524d85e1f6ef70ea
BLAKE2b-256 70d1cae71ba2980305ccd872dad2ec79c5202ad7c371d34b445baa91af177fc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f06f8b7bb5f049eee7fc84b8fd35fc40682abd0b85327be14e508aa249bc195e
MD5 fa89cc4a002ed2211a41d4e33ba14650
BLAKE2b-256 80654e11d6c8b0b66acf26ac29c1a3924ee432fb4f75370bc2ad71e2d96ee9c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405271715182293-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0837f5c142a3c82882fe34a9e925df1606fc01e37ae4e84e434ea40d95a655c6
MD5 3da87c5b31e9bf8207cbecc8d088afc2
BLAKE2b-256 bce45659a451caa400eb55a1cffc83ba083f6678795e1f0c5c5ff8b31f45fb9f

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