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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408071721169663-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.15.0.9.dev202408071721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5c4cbf3009834f298591891641c810b51fb5dbae7aa6ee41f51f20cec3b206cc
MD5 e2331572a875107b371f4df48d2fd120
BLAKE2b-256 584cdbd84513b12ef5eebf782d0a26e89be0629c3b75077f34be5b7ae0cc5065

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8de100447274bcb43c837d11174b29f1e7fa628d877736f31bc6203ef0a5473f
MD5 cd07e8fd7baea0609b37d98740cd83bb
BLAKE2b-256 5cf489af1e618989166f73afa70a8c9e5ac81676b32ae6e9fae71a4b5a28fa10

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f67938a84dc960c470fe4c8b94858b083b1fae2fc2d37c921e2362c000f3b239
MD5 20ffa741ca4dd50ed81710ec34e2dbb9
BLAKE2b-256 34b569f92caa8a5039134795027c8209a9c736ebb36c6c721dc553ee772a0358

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1664a630fa47e25a0acdb9b484e1ba464d2b7538bd9bdae436d24953a571e1c0
MD5 c1eee5a7ed3ac40a25470a43dc6af00e
BLAKE2b-256 12e2e05247a13e7dab77c489c823f9226c9ec98b1e87ce3affdb5a299996f376

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 efabd8378d5628396e57fdd62729f5479c1571574dfbba3e091c7f00d9e66864
MD5 c88df48fddf28ab467fd99c967713a97
BLAKE2b-256 3bdc13a06cfc5fa9f4fc67424f45accade5ea638e13f7eb32d20e94c36412ed2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 80cf859094b9e77eaff67f07d1bba6994b0b30563924b1f71fe508597760e7bc
MD5 a9167944ac4d935f9c13d06de6ec4ba0
BLAKE2b-256 c7b316f28bd0f5f67a3f97941025231959679720e846ab035dbdc5e75517e73f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e093c6b431c512bd7980ebfbf2ed08c79297a9ac9640197ef6ac58af8935fc8f
MD5 adb7f3b164c13d7197c3b0aa017779d2
BLAKE2b-256 cc4e3ee4729559a413d8714ae4e277d357aefc5dc5c0ce91015d12a7825dae1f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 52a0c0734169cba73bf827b76f4a30ac0f78ba9819ec80d6ac60cd3f262bf314
MD5 18b8a64fefe2eff93459b2f16c29d1b4
BLAKE2b-256 f1e54950c51a548ef2218b9fb7dc00feb6086e1ce63dd739ba2af805f1f5323e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb95ab07812559ae0a2fb2ce3221a3a2f4f742da90e6b01ba790e05f7d4d0bfa
MD5 e78606701a987bbb019a32da6246df60
BLAKE2b-256 9d8f2641f7a56ef4d0ee9466d95592124c1df0de0697b1e76e59cb9c30ef90d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b2fec6122b3da080850241d141ecc8dbb5323252345b8aa6644ae9ccc57a6c4d
MD5 f1e211675200d60de0d4a56dd9967172
BLAKE2b-256 bbcf42691617cac005543edceb34a28121600c7cee10be2e55acf601c39a6ee4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 65c26faa14237f2653ceeb72a0f0d5c8e2e987783fea9c70db9a36ced19031ab
MD5 31b644fad4204ef4122219ff1bcf703b
BLAKE2b-256 1347e197beadbf584e00d132c2d02a0415a2b50962d1327f8489f0fc5af27f2a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9224dd220e9d518d54eefd79d92a35dda2575981f27052a64d8abaaa0242e8e7
MD5 849462a4aca1b2aa3293a58ecfbccc06
BLAKE2b-256 2039b0dae08e8c5c926b369b52d89130d6fcf0b6035df615f0db17289d20b36d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1938f50f9be0f7320b458ddc34f75831b18d3c5fc8077f1555cbb4756b37667a
MD5 a591b39db0f4cf932cde041227f59efa
BLAKE2b-256 682cc7d42e101bd88f5091a1cf6056682a0b246cfcf1534e8aea32c6bd1cc01c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df30f98aaa4a3ae07cd5678388d62e1b8ef52d2072255e7c021de409a7882b4c
MD5 1e61cff0b93fc6fc8429dc80af316f9d
BLAKE2b-256 f836a77f864346786af1cf319ad9e2df64f12dc159f610491ca7643f9f0dca73

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 565f8878d90fbb14c21a2fcdc3fe4688075a0a99b16fc4e4adff75d4ddc1d054
MD5 6087c7d8bda0404f7151fd840f443f33
BLAKE2b-256 8b5c21408558ab613d5e511b825549f2df4d93ee0641e649a473d4061163f2b6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 688a1dd5a39178b6954f35be0b0f9c12a5c06913501a484bc14e6760ad4ab127
MD5 81ebeb642081b4b35c87ca5bc4b7c42a
BLAKE2b-256 01da2a37560d98a3a56b7606506e6854b2cb7ed8e333331450d6085a7b77731f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1871b345663da93764e94518cfccc02dcc1228720a43f0ed9c9e767531ec71e1
MD5 9d8cf11361918c34c3594864ea1c2ccd
BLAKE2b-256 d50dbda9882ca87a055c798fa139d5f3ee8bdbe28e2dc70aeb7631845b1368db

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f76f6e798bf922a5bd2734d2dfb6fc52cdc64b452d7f946788bd2959596cb738
MD5 0c898b9f8f7e8e301efc6902e2c5a0a5
BLAKE2b-256 01cc8ef7292fbe835a0fa448ad9b95e61b5f369d283f2387813113c40879da4a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2ac5faaa3c05c931cf2ba794822808396d6c901f02f9f414139751268ffbf0e
MD5 273af2a8da09523ed12e2e8a8279a708
BLAKE2b-256 7f9f21de150fd165e1d39e5d6d2cdae9ffca44fc4543e4e2a5e4337b8ed39a9a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408071721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 22799563cd7d432822d3056e227dc2cf8b7faafa1cde090a910312717f89a10e
MD5 18684d12db657635f6793a8399ca3fea
BLAKE2b-256 f0cb2af1f61f43fa415270f6fb9744b5b4383ff36b80e57ec9efd1f8f444c0f2

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