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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bf0ca0d335c50cc88460e48ceb26fd2704417cc7412987bc137b2692b1f297a7
MD5 db925d31023c445f85eba574328e9d23
BLAKE2b-256 47301c39563b5d6fb286cbb33defb5dad7c94d3175278e4b0d888957cdc1afd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8000ff8fed6c499cbda601884f823a86c38145ae8dd734811f5591ef9b423142
MD5 f67cbd4855403de906ddcad7d048ce41
BLAKE2b-256 1f76e6b840bdd4cd5aad01e1f7276871035a0d3a949e76fb42b87bd28e894b39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c4303d27e1dbc1c35437402e7fc375067821f8c7642bfff1cb43bbc25cfa23b8
MD5 ddfe0d2d59930c417b8fbe26e7843663
BLAKE2b-256 46106e08da68f2e9a5cbff282b0d7ad1d0163fbf8385e84a51147dad33476299

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a4297bd16d11fad292055afb23da109089378e724d8a428155a06af7c4eb300e
MD5 7b7f6bfbfb1f10b5649f1b9db98bf07a
BLAKE2b-256 5ae4b07afdb3aefc51303c17332465fd56d8a566cc1bf70a2ec623f11919a785

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f65bf02fb67cc7005eb9460bb4d7ab24be27b4f216053bea2685acaea8aea863
MD5 99f8726377167545cc76ee916d7a964d
BLAKE2b-256 3ade69cd33fe4ce7066e78da753a9bb3a08b38381f59d3252ae0f48f76d06635

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7c23957017919f2acfdb00c574449402860dadc49189572e01807b5e0a15ac90
MD5 d5c1944dd623e25a41dbf9c3c2e69487
BLAKE2b-256 f4926a2da964994fd0c8a705eeb7f6a78a587ae13a18b02118bc7696b0bf9546

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7ee764424a6b649a6d46f78b87420685b82ce350da473f3a44d1c97ac2e33e64
MD5 e1f973278b4edd27c5e015b0ba0cb474
BLAKE2b-256 3367ee75b10d7398fc063b0f349f8660edbd3a433f794c2046c2b7efd61e8207

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 82ef4cf460a8bd031cdd532eb4e43dd36b99a0cfc5443798a51e962d88eecb7a
MD5 7c9c892ccd48395a0bc66d1b7941758a
BLAKE2b-256 e1f550e288356f53dbdfe358486bf1ac364cfb6df259833659709f11302d24da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a57cd5b347426b8dca4e27832cb8423b2f56248e488583f90b86f423e7eb6cdc
MD5 16124196c683c7ce9697d34d1996f14a
BLAKE2b-256 e4659b0d6a651ba2adb1f4348884b2e98cdf3fe66e7efaee9c88c995411493c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 adad31dd328096b7f0e91f920b164460952132d415bd2fd23deecef1155f0a2f
MD5 05a77c40678a6db06af6bda5557a3ae6
BLAKE2b-256 ff24c4b6b5fb336b94d2c100973e20fe63bc8f2ef63516b60f7734c71399f9ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 381aad5acd897180feba3d4f759fe6394ecebd8335c711590195f631038cb16b
MD5 471df2affed55875b114cdc6e4e4116e
BLAKE2b-256 6e86d2c924f0f41a3f6169b65a2e8bce08c18fbe1038d65225b2cff52a2c69e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bec8cac72713a065a1d38e39ef93a7e7d411c7887f1d97449e21f851a9f7b048
MD5 8f7ea15e5eaa36328d5af3d6ae946337
BLAKE2b-256 248fa9a9239727478d446002e22688fe27450c4f260734b46f9f152e2949d31d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4f615d4b7e9e55172dcb1003deb6d86310d185ee88412a419322e3996b98f600
MD5 429685f859a625cc36e24d21f0360e1d
BLAKE2b-256 ba69f31a092ea22652635b8bd9ea51f922de38099bd9d75ca545f965f3d99627

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b4818422c61e7a263a3f5e99025399b758421d28ad5800321d593a6f47bff91a
MD5 112c9d52034c69f4028d39be2c85a03c
BLAKE2b-256 17662692b9ad044dde6614d81b4dc3f24136098b69b53de513422dda9aa9ef0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f5e2352b7209ed06577e0b75c1013bbbeb3e14d9f951266d78b846d4fa7e42e9
MD5 f5f61c2a3239e2fe3e124ffa9f7534be
BLAKE2b-256 52edd81a936eb46cf0b99639c2642100225cbf84bcc10a9a3a0faf699dd94290

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 03e559debbf8bf25710c48534f235f17e2f0a7c0c82a792096d2d140e6d04680
MD5 4c6d2471a043c775e12bdd3ec4f272ab
BLAKE2b-256 b4db85a1fbedfd861b5698d6cf61ce49fc794fe796db855f726ffc322c5d4978

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 785efe8710562d1895fc8d9d75d73d20380f73bad07c768020c1b49a368b7dd1
MD5 d6a42cce3d3900a8786d5f6266c1846f
BLAKE2b-256 2b2c043eaac35fe4401b3d46636d768494e28260dbb715c9a21f13a8fc82ff7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5c663505aa641e8ee3d770a96a36f52898bef19ab81a1dbcea062ac2517b9608
MD5 0b3bd39210d89238bb266b1f85b63010
BLAKE2b-256 c0b3161fed82344505493cd8cd88c08aa1f3315e37b3886079f94c55b70786ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e63a3b03dc3e952073e861439830df6ee519321a343554681ef2de2af19cef8c
MD5 9d700b14dbdcca6d891c139976bd27e2
BLAKE2b-256 c095bf7f133cba8bd4c67a72cb1e3aa472c93e0448d01d3855769acefb684d89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407011719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 24c465c61d8a0ce2b349e801a5f1fdbfd41acddcad177fdf056bc10bc005d4c2
MD5 24ce48877fdfddd84d5d551a3abf7c04
BLAKE2b-256 ad89f4d228b0b514f52de1fd52884a138832bfba3ac6260de6635aad8998ca53

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