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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502171739452835-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.dev202502171739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502171739452835-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.dev202502171739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

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

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502171739452835-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.dev202502171739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

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

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502171739452835-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.dev202502171739452835-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.dev202502171739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 053166d8eddc336cce1907cea473344dd28c0564ce3ea36b58419dff148af2bc
MD5 ccaa309ca74ee4a046c062a706773f42
BLAKE2b-256 7db6caa42418ca3e35cd7b1c9e310bc50a049ecf512f4a9a845b27f05d48ea4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1756c9cb43b97e22324750361de5563c353e1f8d856e7be82ac9fbeddb15511d
MD5 b2c5e747ab5071d259acaaf75b6eba0d
BLAKE2b-256 fc63d54e818a22d1f2ed10c031a86f7ef4b3cc65b57e7f53995ac899485a4eb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 195a4f8f017304fee19fd9ac2dd30577c87ad34ee0e9ff8931558d8acbd8292f
MD5 c3a6247026c8dd391ec5d09db53126cb
BLAKE2b-256 5df242867758c6b6de4509e00687f9616f61173aca621932c0f5ed9e3fbca6b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5cbba8cead40c7a78b4dcaa7cd6955a691a588ae2e42684fb4a6bd1a5bb63e8f
MD5 703f1ec84ab950e53e481bae66b3e744
BLAKE2b-256 413e7003a8f203f33a321e479e18e073f0e9bcd413b7f0d29e4cf3309d948504

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2c9a15b61873b276f756fc47201aaf32b59033a3c90fcde4f066879e2fc47001
MD5 610cf49d89a87fbe32202f4185a94296
BLAKE2b-256 f9de7322ed64763c8d5d45a51719e9d5f7f3b8df76d013ae8cf4d341de2e8e11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f7431f9a214aab2eac19fcb81163e974c8f3cc76fdb33a017cefc5c72027a4e6
MD5 6e5a22e88781633f3591cb165d766e78
BLAKE2b-256 0863cb9038ad98bdac530cff93a58b722f050e3102d998fac84260cf8e860321

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9fc86f8ff776ee6340ef8c9acd7b2628ec7f04d49a16d8deba5789155083f722
MD5 c1051a20d2898c725fea68df177ebbb7
BLAKE2b-256 fe42c17fadf93edb69dbfc6e615927a6a69d7f2f47f6b33492e3263657879994

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d913bd05a640026f2752dd7b68c966e022eb85d3a5f90fe918029ef984f98cbb
MD5 a8eeaac9d8361ff85d0bf6807e7e256c
BLAKE2b-256 40c79594b792db584eed2880b3cd25e8d1b4a41aced509fd16e698d6ae16342b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0c7f323051a63b73b0575d8663fd0d6b48851bfdd5ada5b0a168993cfc612cb4
MD5 fdddecffd1da452216face78c678faf9
BLAKE2b-256 49c6f96ba86617f4228e44244f7d64276d59e476cfe4575ba18a64b0a25c2511

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c5b633e415a6a6a12b32beda20744fcbe3c0466082b8069d9fd846300cf1ffbf
MD5 78f493edface30c1ee3fc77381b4c705
BLAKE2b-256 fcd4f7b424ee8e8663be0e6bc37fd2bd8821ebffb90e81c15420ae59b2b9cc0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 25da55682f969094d3d498bdcdf125614f33b145ab82ff5d9e00c086a7185494
MD5 b53f358cdb5929272840b3f063362a65
BLAKE2b-256 3ea41e9d69e7f709a7728eda77928f7ab242cc84ac0f55ae41c8c286d862351c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4fdd978901d80fc65fdb9fddb7d16b8bc4d97d5d8b2aec9d58a7bdc78ddf7354
MD5 cc03dfafa3db38b5b8fa09781c43420c
BLAKE2b-256 41402a8759221c58c9db09f974464bf0dcff9600b7934810bf04730562026d19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6db6af572a052d771a72519e1ed486274a3e1082831488d304a786c964156e0d
MD5 4e7bb7e0ad33afe96e1e701e48557791
BLAKE2b-256 2764d11e0e7e1241fe1387eda6cf30ff28f408dc0e644ef6ba7c71e80a22de58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e60d9f53caf50d0613d9787b5855aeb5892b0d2afc831efc95ae7204f2618c4
MD5 e127ac9dad1dd0b7d82341bd1662d2c8
BLAKE2b-256 41b9beea18617460f38c76433e4ab607ed1fb320f8db7ec8f28199ff62d044e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ca239cc5c2291130077155efc3cc8d0343d5f31a067ec9e2b4ed9c33fd3cf9d1
MD5 7f57bc1d2b459e4c422213697aa97e99
BLAKE2b-256 d0984724fd632484a71c1cf2863fcbac7d57d24d9db83e6d51e35c01d7a5e693

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 34a1ae36313e15f374a9c5b8fccc5ae4b4459e32488fb24d7bf051d2c3b32d20
MD5 86571e3c1ae4b3458af8c8dffb885677
BLAKE2b-256 48c9620586677a9207a787fb1aa82ba3afae8dd3a799ba340848cd72fb928238

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c5ebcfb109fc28c71dc786d8551641a3f96fd261d4567afea282d07b3edb6ec
MD5 5fddb0a88eaa3c6d9d76a69884d9653e
BLAKE2b-256 cfb793e5e818b219b1d4f6968518040d5b8fb40251993e4a4a7ed582d60a7fec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6f43c19ca3cd6a9c5cd1dbf3b7e416e5a529a3691caaacdf89afd875c425d2de
MD5 9f5a6c7eee692cd55b596a30ffb73cb1
BLAKE2b-256 941a27d32a4e1bc4be7bb46006e51f5fd3c8a03fe64923aafd0a608115061430

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c3f7942d7999c549572cc59ff6f3b5dd103144e4e48066ab3561a845343a4d3a
MD5 c77ba92d159817bfe66b4afdb61cb998
BLAKE2b-256 e50141ade8c0fd30a27b4d9686548705ed34d6714aa6c98690dfa7deac50c0e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502171739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8ddad6d77ee918d4ef1b14125b950805ac16007003539e1648a89cf780b2efea
MD5 faab2acc5f533aae2e88e58d568e8d2b
BLAKE2b-256 f483568af66389f0c3d5a9db9b7556ba8d767afaf73639271502248e1ac151c7

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