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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 374e96ede71d3c15439ffe1e4384117b0b792510d3c2a07b8c081dd1a408741e
MD5 c9227bbcac6c4ea0f0f68df11cedb726
BLAKE2b-256 8dc9a352fe12be5d34d144de93f18b8ad076f7a3c4a728ae97e91ea8cec52593

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fb5a79ee6ea7aa276164bff1a554fa65f0ea7a4311d39d226d30bfd49fba7b44
MD5 0719f314417b914972c84161743aefc0
BLAKE2b-256 a02e894e4ebb1613c6d0415d2219ab13e97c3450ae1fee91858422977444eb82

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6c462347b17438a1245461326df0a809e9abac8c5be9c3e78e016f7b10da2ff1
MD5 24d45947ed9f72b8d371c00ec9358470
BLAKE2b-256 138ec4d80fe4d7ce351445d982d5baccac7b503419c50b14df8fa2065dcfc120

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5d43e2523b6a5d3e3bfda5531e2186b859ccd1b554c57eeb725d14ad8c6a3848
MD5 23b34223c78ec8b12f20ee0dfa900c99
BLAKE2b-256 37db8d50226c0c50758b3677af2c9bfd60bc5d5ef2e6e4c9e8d864b3175145ca

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c411fd2d9350925adace3e5266b66ec044b578b2d431c8efdc94da2f8c541503
MD5 76e14654059f000837ee44121040b0fe
BLAKE2b-256 6cb4f10313fc485e05bb834c42a5c1c045b6ebabcf9e14ae7011799beaf0e685

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4da97888b5ad555ddf55e9d70b71a9c640462396ef63160e654864b5ce51065a
MD5 7a9c6fc27a24ade8251095dcd09976ed
BLAKE2b-256 8f7641014c7de266899f2069f49901e16f185bfd3cbd0269edd83a480a66517c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 02cc7683bfe8420c15c25469619503447599320ba6395871d0b617d7a837253b
MD5 dcc03d79df58b11a14f1c909d593cea4
BLAKE2b-256 82b77fe3cf94aa0c3feb822686938fa6290051578a2cf72ad90ed358d17aa100

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7c7bd88b0c30d8e2a1306f796a5a356d51d4cc97ff25826572a3f0fab77e810d
MD5 7843b5eab2ad8a75bff14f0dc622bf9c
BLAKE2b-256 cf60b5aa1e3d5592067ddd492a033ec2bff23b7f4c478055ae2b531c078d39da

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fb7680e2d92b38b5d6185dddec783271461b8c5588ad5fb5ff3c02e0a1228cbb
MD5 2ccae5146894841b07bb8c054e750722
BLAKE2b-256 107f482be76b8a41a2ab646599e2579b3d447380cfbc85317e7c18bba3afdd4a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6eb1198d04a181acf95b7f90ba4d13356aa64039b634785712f0790b722d84ec
MD5 3e362b63d5528bd9d9cf48986b747409
BLAKE2b-256 f6151305da56ac6cc4abbc511ee897a78dda89431c9c963088dbc8bcb4d1f373

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b8242b362d8b1c3426193e157ad1744003e81c12f3d242a7b48196f46753ed3b
MD5 d72744322c7357be22f692e380b2a914
BLAKE2b-256 1a72cc9444d2e7c882a596182fb609b2feb08751e5f23cba72d3a87b72735c24

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1fe0d9fd02ee5aab111f88769f20e20d796ebe27979fe85befe8d77dde94c2ca
MD5 9ecd8e8a55334ba368a7757be3f2daab
BLAKE2b-256 9b99aca4a637b54e47202fe8c395fd0cb07f3c1919767fb5c0ff68cadb756a07

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7cfb41a1fa080ddfb3afde5c0cb3e7cb96a5299ce081e845ddd033723f69525f
MD5 f6bfb39bc5f633c831a14a4020ad7ea6
BLAKE2b-256 816a724bb19b3d84ccf4eb863b7a0a32451454acac0915a83848d500df89db21

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 202195b38c474bb87373f57c64c8b16a29b5a72bfc38b7e096a95434f82ef069
MD5 266529307962066f73795be53801ea91
BLAKE2b-256 a265f24c34de766facf27ba58393cb8312d6cc8989eef1716147dac09237d0ff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2c8a556de2893b28727155e0bf227d940fa827dddd3e15a70564196fc755d5e1
MD5 b061ecaf993e636534225e5a1433a0ee
BLAKE2b-256 8eafc8f636f1465b3f19a25a52860764018ce23fe49dfa342c996ed6fa6fd80e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ad52993c7333b376e8d44fab560fe4b27119081709dbbfbb52eaec4d4f6452f2
MD5 ae323940a891ec5eebe3ad2b0413a04f
BLAKE2b-256 6be418073970cde1275a1457aa5300647ea15002e671deeb2a025a2c4dc8ac4f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9f19b44e980608b635ac49d389837982c565c585ae8eeff69cd713721843975
MD5 ca64504f839691618bc7d95b4344e7fc
BLAKE2b-256 00dc7838574294f22c7ef2d2d9c2dfaf9570d0c080c1c59c025577f46931f532

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 01081e458d07378a0442244069d0c791421fb369c8620ea7c6dfafe95158d86b
MD5 3292dff10689df5f7080069cafcaa97c
BLAKE2b-256 08be466e166b0db549584ae092826cd55cd79258ffa78384a069dfc6c96c6f6b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43190b1492f66243a94cc588ddbd022999ad3f40112148d55516503a20a69c73
MD5 bb14d8e9362b1520d38dca00c197820f
BLAKE2b-256 a88905e4b6271f08fa20b5c8d2f8afd2a1d4f09d26e4ce227f25e66e0811f34f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407061719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d477df25d580eb2cf354f76dd5d410b30cb2a358b309c8037874170a16ef151b
MD5 705bba8c23bc87bddd0cb74c2428e2a0
BLAKE2b-256 c33e83d33b2dcc8425102d6f5836f2b2bc37a288a0a8901190382838b905de6a

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