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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d39cb5a054dcee169ba6cd276a1118a2ed263cb3e214f04ce5f3da72948b988a
MD5 27387c36cb2c2117c0a1087e40457ddd
BLAKE2b-256 fce96d6e8d37bdaa41db69cf5da69aaabb5d5001c5404c520f1541ce94421359

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 28aa1bc5ddc71a0295241b4d08d28d4967ced286ac9165b8149aea8ab0607ca0
MD5 d60d7a5b3f276540a9036f8d34a68831
BLAKE2b-256 e09a818b147f6dbddc5a480a881c24a69acb8a638296bdd18f07873f9c7f0b64

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 691a7162f399fc7297c8e1195aaf7ddde51a0af1d537bfa67316bb8c7fa6d3f8
MD5 92d0a8604994563779e1ffeeb1912128
BLAKE2b-256 d7a6c76b3fcfe916395e8c1c7076458f35716150c2661711a545181b8c73d48a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e733bedfc88ec10b50799763bb5493dc8c63154c3e280086ad540d1a3d5927a
MD5 9d8665d6a0032b0d63075e722b62fc54
BLAKE2b-256 5c07d4919f79c827ac6a51e308e0a9c83f817ec850ac0491af908a2d6c603e85

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 87910dca1d592109c434f6eeef09c0c4592933833209a8b3967a1cd2e541e4b6
MD5 7ab463e933f55dc8743093a403de2c22
BLAKE2b-256 d148f5dc9e435cae0983c22dcae90db00ecb3e41ff2cd22aa1caf43986c37370

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ea300db22c7cc205c3f00720df159923dd68af79ed6ec9514a3098ec1d6b7dee
MD5 3d35bc68bb195c473c2ba1f44b6ac52f
BLAKE2b-256 cf7e2f3ce11aa8238f6efed94f398c3d0ccfed61f065f719eff1c757cd641a40

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 54c96f842acbe68c24b3159023a279df29271c18e04136ad4bece6b6f3bb3e4b
MD5 5882feb32927c44d631802965cc88a93
BLAKE2b-256 264fa204f7dface78bf948f0e2a1e315f5ef1b8d8f35a569d03278179451b29d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 07ab6b2c739d1fcdaf83a57a9331a07c754f02cefa751c88c4f0ceccf2fa2430
MD5 7dc82e9e590a3791c9a0f2fc136ac2be
BLAKE2b-256 eaebb24418639a1aeab5f110c41db6a4a5fa21156d3bb1a6321a6dc24c03ebea

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0c9148d40cde636d5085b929e3cd90a690fc90d02c182313193b4a3926baf240
MD5 df4904b0b55f44bbe2dfaae4987056c6
BLAKE2b-256 041429a6aea12fd9858ad11c67df7d9b6416c32e5226fc58403edaeb7a01bccf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8dcffc2a5cebc343dae004010d2d0c1c439f0fe24df070c63e1ad5c0b487bc45
MD5 1d892d8ab214127d477cc1e7a514a829
BLAKE2b-256 2636bc255dccf65f252cff1a3e5cb2a247a4631b13886e7728d96cf52d9ad20e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f316bb8cb119ddbd7b878f401407a4d1d2a76b0bf35b04c1bc31ff2d68a28cfd
MD5 96cb6c2499d9090052d55e78fe947068
BLAKE2b-256 439639f142c2c01ec83298b1779b4a9d4bdc822a1ea54ade3ffd5d993c2180a1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea55e12c46eace5813da229b140672a9e44afbd380944aed574c1c5888edb9f7
MD5 cc2e667ba1b96b474c2b74ce3a6a8754
BLAKE2b-256 b1ec87267309caca14ccd66042c02c74abb0b52bba507fdbbb8a9b6b3f7ebaab

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0588929c93334e2d4286bf761205ae81731c1fbc29701dbc5612202c9754ed37
MD5 849532f12e12c61d4bee6c8a917c8acc
BLAKE2b-256 6c8bf8972c9571133f69d3a8139f5019927bcd45f967129725f0407999d98c24

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29f17e342b5974765fd97053ff6eb2a958e0c9272057be7b0d88edee0353c6c2
MD5 a18c29636ee373b69faabe9622627c95
BLAKE2b-256 b19537cc6abb51f1d9683b429987c8f51d93602431135141f11f8cba8b0a9fda

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8ea8c6150c59998a28955330c2c7ef7b14d502e81f6b9fd1c0a5fd6c2052f4df
MD5 1bae63ac6c001de0ee198fb05b6c25e4
BLAKE2b-256 6eb95cd337fe52860c19a433dc6d0daa926a95dabdc55d20410d3961b59e1e7e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e21d8c18d909dd770eb3795d893493854625328945fe1777eec78db8ffa5a0ff
MD5 ca9ce99fa90c2295e4c78235fff84a31
BLAKE2b-256 fac97012433f363663393f96816e4aabc5f89fdeb70cb3bd28412854216f8b1f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 779f9382d253828de2d0ae49a1f4a96c2cdf3f9712a070283788eadbffa12a96
MD5 0b19e24798e1689c8d95ef5e031509d2
BLAKE2b-256 ffaeddd0ee1bc66441f19cf5db9ce283241626991bdb2c6bcaa9d3e2172c333c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b63e70df11a8deac2a9187a3a3367b5a524b49406176f5775dd8f981148730ec
MD5 a0247fe620999c7bd64bf7dc28e80e55
BLAKE2b-256 b1af885fcf4ce59e6443e76b763c8e9ba3b1d71756d38bc0b6104811fbabd9a0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a4ce03730e08526743fd2f6eb10fbe7a9a9d99f24474fdfe0037c9b284c2f245
MD5 fc631c613913ba66d454d0551b5c71bd
BLAKE2b-256 b676a992272cc40711a9eeb1ba242cc6d62c87c7c0e067d809c14059ed1a1f50

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502181739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 562bc514e3c29619b49d6faa0643cafed6522e8a2505f82ba94e24a1d56c678c
MD5 6e612567126b6823de8023a1ba623490
BLAKE2b-256 b1ee6f1a985da3ac29bb13fc8b0a3aed9f1f6e82839ff02c88db38ef6b9ae259

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