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

pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.12 macOS 10.9+ x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4f7a8a7e66b3827bcae772bd9d88505f2459d2c7ff2c20f047df704acba47310
MD5 bf084b624d2882f67577ae5af66c7eab
BLAKE2b-256 5e5dfc86987d30b5ae006b15613559f5a9458dd1107713fa8561bca5e95503fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 183c8008072e65a315684bb16f7dd369ef7a395bc8f6ef923b172c2e4377eadf
MD5 b07c0fc3655e2220f1b1a93d83abfbce
BLAKE2b-256 27120a5b70de1c99117bfa8155747e8c59f860ada4c1965454618bc2dd618907

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c11f3b9bc8825813d92642b587c8da5219adcecbe29f1273fe0d6c2ebe03413e
MD5 d3dc2509b6d5eaa12f67985bf01ca703
BLAKE2b-256 6cd4b5be0ff6f867171ac4938b8f7c7921fe64422ddca0cbf56d724e5be83cb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ddbdd25f4f25bd14f3aff4a733b78a638d82a6293a79d508b873fe87db69fe0
MD5 3a97319fc3a29603a7eb73c8ec4b150c
BLAKE2b-256 376d61504b5fec98fcb6095f0e94319cbd426d9e0c4327649a1b3d6c544c1544

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 42ae7887db2fd197da4dfbe34725d81b9fa190cb5115aad9e86d967008ed0b3b
MD5 9f14136f717cd1457de05998d3e510d1
BLAKE2b-256 97dbc8b53b85402e47dc20417fd5d9bf992ed5e86ae17ea4f32b09704811db19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1b1c66acac732f211d46ffe73ac7b5cedb78bc26d9055358f5d5d2a10411560b
MD5 12921337011957f2071308c7744143a4
BLAKE2b-256 98ec86e1e719e69966fb23455b18a1abfd404ce05415e293cd12ad0b5974e28e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f7e40188db1685f1257603ca8c400f9e94a94a7c13af79f67cfe7d0fc83bf27b
MD5 9c624965267d0a75009981800251ce01
BLAKE2b-256 8fbede75a2ab4540c9a598600e0bfb4f62e646134ae0c651b7a3660c83e44792

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9de326ecbca6019ff9ec42c4c854171e4fc091e7e544a0c6295ec5a8d78a8a74
MD5 83aebc146bfaabc88fa61c710cc0ebb2
BLAKE2b-256 6661cc6dc28ea87446596822dea345046bb2047dc73a0b2f53457a0dc18daf75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2084567f26893b99f0a0dc46b9dfa6411791544ffee49e2329c58a497b242fb4
MD5 a6d8194d390f36088561f9ccc1c46eb3
BLAKE2b-256 9cbc0d14967ead1a701d66c51426a80e2a46938317fb90ad9e94e42cda0bb7c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 22aaec74d3ed4ef9457c6f8fed7f00c5cfc235bfcb5fa18448b96a3f446d3ff8
MD5 6dc32e59521c3dee589d0906d4229c4d
BLAKE2b-256 c213991eb5a0e586400ec3cf8d419543d2d4c0925de2860bb8b890b8c27859da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e180eb3483a162366b1d90411af736574a1d837930442b1cf676b2b4858031e4
MD5 56df5753fbe4528b520439d3369cbfe9
BLAKE2b-256 221e95f3887f7cd82f3f31e769b148ccd23788c8264320dc614ea9aa882bf87f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 adca742aedf679eb80b3e2b3760db2584f87d7a7ad90efda0c76090014476512
MD5 dc46c984d5dce82a4f1cac8872c2ae54
BLAKE2b-256 ec763ae9d3ebc988d634b3c3395f2a731afaf56f7a358acc3e26cfeea58bc8ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5d335b77556e863c1a1166ba061d217787ac186e2067cf3de400340d1506db8e
MD5 5e738ff04a572f188ecdef1a7eb43366
BLAKE2b-256 8c12e3dd326ef25a1ae2aca5025d4b33d6674d54437d569940e67486a5432d04

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e78afeca423436fba671a1c8b61091b85b08411be0649b4685cb2eeb6d6a2174
MD5 689aac39c9e452a309b20106555b0d59
BLAKE2b-256 c6e77b7443ce7e5193df7b17f6e168520d298dd75259ab4c136ff7ba73c32b01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b53b3a6828684a07a9df40a458fde9b0c7c02d593f67e43b35e70192fb5e91aa
MD5 d4df835fe3c59caedb083b98730ab64f
BLAKE2b-256 2b7f18a993e605fb24d67875261091916ee037bfa60837f331eb0e995750c42d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0d21af3e47e90df4b4323e1945f6cf189ac6aa43a2e6d7be108a265450bd1f05
MD5 af90a617b8d4e91191abb10f5b1289c0
BLAKE2b-256 206552f6908809f3b0d084c8c486050efe78d48e6e067e2645d205abde52601e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c96470b3bc2955422602e8617ee9fd812da11a9dcdb851f8c2a1f14a257c7af2
MD5 2b2e6060daf3c550964a9fee182858f1
BLAKE2b-256 14e8a78e2b7d2cac4653e06170518a8f596fc48ae4a1d7e8c04271ca6c8286d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b497a2ba680df2159ced4080de951b04fbef97efa68ea7369763c92a67d19e35
MD5 d21c2f794f7441d1604a8f733061b89b
BLAKE2b-256 f02befae2dbc304268d21d44c7acd75b07ea72b5ec75607c25332a78a41c9f8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9b71806dc2319b1a8ca0bec7e278674312dcc81d016e9e3906b54517f0f14484
MD5 8e74fb70cb83279ac80060e7dc82a3cf
BLAKE2b-256 73b26f08d92560890e19f44ab13161808bd57f04417ad9999774516cbc7f2127

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407121719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 74393a69e32bb5b7824ccfa63fbb1e5c268109302aae2ea0e17afc718b7ccbe5
MD5 96ee827b7cfbe9e3fd421f1b32b0a868
BLAKE2b-256 adea0c4b29a87cd2338dd85601062e450b193de18bf66b5b40d346825fd654e4

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