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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406301719384100-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.dev202406301719384100-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.dev202406301719384100-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406301719384100-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.dev202406301719384100-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.dev202406301719384100-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406301719384100-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.dev202406301719384100-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.dev202406301719384100-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406301719384100-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.dev202406301719384100-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.dev202406301719384100-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c8c224b0821e9130296b5e96b91e4bcf53ba3df27d86e87d9ab8614bdde0b6ce
MD5 7aa16ec82357b194f6571c28b1585a31
BLAKE2b-256 f0d6618396b4c9437254f84512e1914d68b986c2f30d2704472d86a2808970d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6f687d6a5643db5a4cd2108bcdf18ad2a802f6166936089bbffc06657d88d60a
MD5 fd1889e111d7a49d32a60404b81bcf1e
BLAKE2b-256 6c502e068e2604ce07c11b072ac2d5c43048451cda3de7382d9c3593bb398e88

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4d83dc5dab5e4a5ca3d3797be482e8a371dbc74aa369ecd04e3c6bac7a66205b
MD5 ff0512dd6c9355dccb207a1013bbfb3a
BLAKE2b-256 fb04d403972e2a31aec873c06db58f45342a0b2054f906abea5c53702a211558

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ef7b04415a53202e7d7c7e0e4d7ed75c57b6500382593fd8fdcb8505dace143b
MD5 4becf3607e6f0af3a49da09d052a30a6
BLAKE2b-256 070211bce5f7d710633a76c38a0ad371400eaa4d6bdb60174de129d365db6283

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 04207c9f78f39b41540383894248a1b1a85b192d671736ebccf4c5b3b2cb203c
MD5 45c8b81bdb78bc1f346756f9546292ac
BLAKE2b-256 1f4bad45e0f550794d6c429c9f1ac6a0c841e95bb1510ae4e1f06f5315c6d103

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0f40c3fb56692aa694b302627b5618ac71acf5ba21bc85092e67eea52c72b157
MD5 48b643910ab4c673bdcc96f55b2f201c
BLAKE2b-256 db87ddfc30e4653a538424e734851ba33f283e3054bbf5e8db0616e8359e57e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92274e5a47e84443c90ccb3f355507e1dc89354b272e86340833f36288623a70
MD5 f1f3e47427524d6407d46914487677cd
BLAKE2b-256 52797b51988c9248fc0e3d52d884ec12aa666808cf04ecd304a79f9526351926

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b89567c8c8dee3a04dc93f3146c9cd9a3440e14bd5736b673d016cd04f6e1bc5
MD5 02fe47e0fdf7e0428fcad2bbead455a3
BLAKE2b-256 3f1303b0aedcc848a3c72e74e4b4b8cc64cd6082f5524e917346ba621740a4e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a1b8d7f912deca17ad91e5891130ce248447b14f2f0db9e7d805a53e849c825e
MD5 8f0cfc826d291565bc147b31f93aedf0
BLAKE2b-256 b36e8e7c35613041c41293243fd795199fb1884d82a3a8c9be249f883205d813

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8cb2915ce239aacd38e7f6ec7ec8c04c5ea6b1a9281b54b5dce83f26e1d4a416
MD5 d17f04bd5d7c9804f694f1b5badf0714
BLAKE2b-256 4d4120e7ee769de861ceb5f0f2bd4980e3733652c931d5e5bd2ca183054d3663

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b7e5fe3f1758b5214ba274fdbce188f40e375885c35a7fd1363bad3f750b3b5c
MD5 83c7ca6a29e049c0ce93114261f0e660
BLAKE2b-256 6ae113257bb1f075ed267e49d0fbc45393d1fac6e584d92912aae4509344b7ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa5ca75e7a561cc7534c321dfad9e60ec25b4429e071705fd9586b9eabda38b7
MD5 8dfba7199c7cf13900e0b781c7533e60
BLAKE2b-256 8d5ae68143827791e5f0ee6ccfe5887af022cb155c1c917f2546edfc500b147a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cfd069bbf818b86ae9027d3b2021475dd5e0b6924026acf61b9c73e9d5001bb0
MD5 745c6489d882fd8a5c922afe75e31fae
BLAKE2b-256 1586a7f3813579ae6f617529172511da09d33333ce74b5c5aaeddb201f8f7dfb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6c56d6d6f2b885d72f5dad5ddb1e91e5aeaa91d0c35f2a979bf78ac0e754e7ae
MD5 10c955fdc76c1209bf1ed7ba47c876a1
BLAKE2b-256 bf391a59e61af9ab3b4b731275f194d7871d13d023ee514fd90d17236d075232

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e2d39621bda6ef3cd0a73391992196a006e7d8479203c4dbdebe9e6be017c76b
MD5 255bbf71ca2f36240a3f8dd9f91a7436
BLAKE2b-256 b80ed54d37cfc625dfa5938228018fe50ecafc8ee64791f506d7c9f04e0123ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c4cb98b7881478152347de82ae2b5f159992c3345f2f793fddcb7ba1a6a0abc9
MD5 be72ef0b875672144caecd12340b14b1
BLAKE2b-256 73d41b285fff3864a6617a24fe6d15c84cf8abdba4ae62e9327459261c963099

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f4b429ed68991505d8134ef120337398f8a6e9774a93c336941194100cbc84c
MD5 283c164aa4d87785a0efa34395f56b44
BLAKE2b-256 1e76797720c474b9d51d96ece72840191cc33249659957482df3ad6abc229b39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8ffbb2e6dc1166ac66f01e83e6cc8a6890afdd4fdfe8a0ce13a0f18e7d6e36b7
MD5 700cb0d78daef8e7e22ab7ef8a762978
BLAKE2b-256 3607ef21122e4caa0e749a3ca96d4dbf028068a6c639377819b8819afcc08716

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0181be552329bf3a6e1a1d7f680ff2ffa9a561113b389da41deeae867e28e742
MD5 be20562f4237edb00bb019ee5945e46d
BLAKE2b-256 2ade3e57f68e2de16f22c624bad11dd5ed4ee00fef6f49c43a06f087ecd8d7dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406301719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6cb8053815b80969feb36b161246e3d5a74a536ac31b0ec27e0438420098440c
MD5 c69d9081c59188126148da3e25914e73
BLAKE2b-256 4d8523217b0a7da7c9ea4411da5b7821a96e23ba87b09787f8716ed739ec0aa2

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