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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408271723794729-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.1.9.dev202408271723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408271723794729-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.1.9.dev202408271723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408271723794729-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.1.9.dev202408271723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408271723794729-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.1.9.dev202408271723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 77e46ab88a704a25a2d873822c7400f61165b276686f06b9e33ffa74c1d25841
MD5 d4d36c4a8e95fc1ed20148e8f2a4d387
BLAKE2b-256 62e999230018393e87374edb7fe7355e6e1b1d9a7cf5e9c7c159b6b34876d1e0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 719c78546f9d1eadeabfab9a2597426e82cca2f89893351ee47d12752ee519d2
MD5 cd0ea6c1d797d9d5ed487da41bc53ed2
BLAKE2b-256 63587cdb5481d7e9ed27d0cb9e99a8dfefbebfbe56e9245efb605a3a2add5074

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a13ccb0989975c09c4ec46cc273b2069bf9549361e8106ce2c16416ecd3f3f29
MD5 1e0e503741a92bafb27163133eeb2723
BLAKE2b-256 1d2402a4f77465bb1c1177b744c3e5acf0418b433c3c8f1106fcc7fc92715946

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ffb9aaa65885fa110da50eeb2a42f7de66a9eb60d6f4e338581ede4834e6b97a
MD5 7d0d15d9ec907e3c7733ca70ce8cf3ce
BLAKE2b-256 b89198fd9925b39c578af6c1784fc5d5fbce3f8c373e29b4ae3b5cbd8c605825

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a290e0ab8b523a306e3f8f1a35ab33fea6d2dd5bf7afab6e922085cafe2ec650
MD5 a39cdf1b0f713a4f458d67060e4c1124
BLAKE2b-256 2a34628178fe41d4a8869bac1616838df20f89fe2ce82e52c4e2382883869a30

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fc40c964de05e13f09ac2f21327e4f836931b49385d02c151cb2b652224ff466
MD5 16f8f993d5ebc0bbcdebf8c397d7842e
BLAKE2b-256 cbda67c8d6b8deee613ab6167f41deae99e5349b918275e129a140a0a011c3e9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b33a0923984eea4d0af1f3024b3a2ad70389edb6a98db0cf29185269e5f3ba79
MD5 97bf0ed00ae2a8cd2f44e043be7ba3aa
BLAKE2b-256 33184ab2b7dcdebd7a6866832f9181e936a48adaabf84b0a3ff75f68cfaaaff8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4383aaf2ef3b16a052eb733492c26dc547120e72ddd8c7e39082f27961466089
MD5 3c79891f4c0d005372aeef67fc96199f
BLAKE2b-256 26f9bd591818ef4d2c336a8f07c161bf9079c4195708e2467e63ac386c7f379b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8e37c233025f2eb9cac588e2fc956c3e140cd745c2973ba6ee1cf5449bda44c
MD5 b09e84cd13c0114c26d6b9caf6a6cf4d
BLAKE2b-256 6de4d748179f97daa41bf4f582233c99de9affa70da5147bf46cc5489e57283f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2409724ac88b32b7a372e7178d6dd00b907880766471e428535c9d0479bfbab6
MD5 5cd2209bad80010043f29c4a6a24a0a7
BLAKE2b-256 78845abd5e51f86008658cb4241bfad266c42e907ff967d654d97d685bf942ac

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1aa50a611158d62f53b81ae9fea2b20afd8ca82a0762f010e38fa6571c1790e1
MD5 c5ff0f14bcad94001521dbba15b48b73
BLAKE2b-256 48fc2fe493594e340715f2b30321c5579224475d70d47fe44a70bd534d55a8a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d92b6377e202e3fbd5679b0160f982dd8e2620b5f38389e6b4b4c6381fac718e
MD5 55a4d07fcf45afd4d71a89ccf8348b77
BLAKE2b-256 e014ce338fbc589d12b77a63577bac155ac3cd70ab2ce77670cb7906aef0aa16

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2a312beadfe1fb08c6d61f90d310ee1c8edb7234ebe5129cac5285fdcf7f07a7
MD5 b5300b237c167496f56e8f115d6b3596
BLAKE2b-256 3551b0218ed65d0e5cb6a0300b9578723ed1dd1f9fdfff1bc5323f8081944d9b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ba9b0976a9df7ee00314d5c24e7a5d6243acf690bd4265347b7e8a76f645e63
MD5 171e51abf86a57ab9707ce649129e815
BLAKE2b-256 b001ccf76483e9f22fca2ccd11c69538ee39435d7759b6131a828b12c2b9adf5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 54df8f786ba8d81d605c2facdf10ff55c61177f5744366c2058fa261b081cdd5
MD5 a12e81c5e9d76cd8834887bd69073ecd
BLAKE2b-256 02a74f904d5406de2a1fc660fccb717e3ee99a4fddde23667888b098351c37fb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d9059112e5e385b99c6900b858916e0ef16c8d58a0fd13b981b67dfd9f11ac25
MD5 b03ea71ca2a814fcf535727d4d31a8ec
BLAKE2b-256 936b4d6b4b85dec06855ec2d0b38dc359985f1a4360c45f71e4b9d7c13f18e47

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 102f2a055bbd4f4370ca014599dd7fabaef2ff7e27a4d608b83f6dedbd4d1a8a
MD5 b246480c6765accbc7ff8acc6b5cf91a
BLAKE2b-256 8a700aab601660c8f103769681ace7d7051ed94156afdfce9257a9f1ece94d23

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 919b084dac23425f6b4c6bdd66011adff1a4871b91bd76426b784abea40106e2
MD5 6434e0007093182f1c89fc5d904c3db2
BLAKE2b-256 8dd27aa03eeee6ede6c53a0facb5cc96c8f6c071366335b04d753ceec0a26c40

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 502d788ca6b40b357cc540668d2d3699612e75767ffe865f4d3ca9fb8282e443
MD5 d293f77a3816911f180e23835b41824c
BLAKE2b-256 da824b5bf62ba59dd63cf1870aac9e5874adf7517d9d81a6be982fa1218443fe

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408271723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dcf90bf5c3c156d03f323af291859c145ec08e0f4a435061ecf67182bdd1e727
MD5 a0d0bae48e5038f2a6ca3c574928ec26
BLAKE2b-256 a9039d10d91daacefbf0efcb74370a156ba3015efa32c8c67e340ac821b925bb

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