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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 37a77145e82ff909acb6aaaaa107ca4c12574a254704aa5c86272fea1b43e95c
MD5 30119445ddb34ed17f70abf8daf4e55d
BLAKE2b-256 a60156cd481efd2181e15bbb34999fa93462bce43be2388b26b21313cf9cc0ad

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c5bcc7dafc40eab611cad6781a457f506ed7869792ef97f52262db5125cd9539
MD5 18ec026b62705c18230c6d35557f389a
BLAKE2b-256 2ccb8ced26c04000c2191f77fb588db31247845fa429441b26883c06b28ffdd7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4318728a2c76cccf1b0efb99f4a6eb7d19844e82f7f21ca1a475503557860aab
MD5 3ceff9da604989735a8f7229a4537f29
BLAKE2b-256 7f67ac43cd7ed143ae39b3d35ad067bfa8c286d8b611c1c9f7f09cc9fe780a0f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05fed936eb5af88269089e64a7135b57e38300ba9e014ecf5509fe15cb32b0ad
MD5 e78ea22599881983414e694cc997c0df
BLAKE2b-256 815539ecced35d044c018c65c5bf583f1e7084435abc5bfff4dc5f658b437831

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 861e4d7a202d6d9258c6c5baf74b24d6b660ba87fe8ca83319fff7516aac3f0f
MD5 86cf4eef2564a9699ba076b7a300870d
BLAKE2b-256 3d6542d094e61f9ad92ddfab18d61c4aab5dcf878d9917d3efd373c76e005571

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a3e10aba3de4aedfbb7c7ce1121fa573badb7ba4ad481629b4799e3e67bf52be
MD5 92a3ad7faa1d67a554b9170938b16727
BLAKE2b-256 bd6efcbc7f00c3d2c77ed9fdbe2c1857c6a65b16ca37c590197c7b66f1c486aa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0d7e9f3dc1ec4a3e6d9573214c49d884ff7a40244e9ddc31a4c94d432e32f8eb
MD5 150c36cab5be652cfa6cb39d166f3da3
BLAKE2b-256 6b57c3c247a7eed750552a0ca351b95e459657cdf3c1ebf0547e9b8472041872

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 08fc75430110d468f506fb854cb5cbdb2f97a29b14d235d34120fe46ff22b9ab
MD5 9ed11c503883d69a4b1a8af862be1574
BLAKE2b-256 7ac24c112e965a3d641be8f745736ac655491828d47f00e18e2eb6be96f6c08c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 59b13d3665c64a441b58f85a9515089796f7d1aab44188c62ffd058c0f2c4557
MD5 77f7658c47a82337b879b24e3e60b7c5
BLAKE2b-256 59ef517dd72c4827f23259e12d4dba92790f4efec79b8a1f0585525bf80fde4f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0c3c7bae182c0fea7e55fc1b4623e4d7cde50638ccd3ce830a654b92d1b10b2d
MD5 86d8f9d8e664ce8edcb52036d44a9667
BLAKE2b-256 7a263c4c77a656d99d8924435506bd499e393ad8f8425e689614bf29247bfecc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f2c4bfe76966520737f4d11a7b8d12bbe6f44a7ef085295a4e21df6e47ce8eb5
MD5 58f463812f5ac29d790ee45a90996d99
BLAKE2b-256 e99f117c1772b1397b04eca36872a4216f2401bb9c8500cfdb0c2608cf85188d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ee21491a00109ed729662378d7115a9663480282063e7595f2712fc0022d9d1
MD5 06c966a105667f65bc9e999d1f0e3b7c
BLAKE2b-256 8a947c2e278334dd47fb589fa1ddc62af2ed6a2ba2d983478839878deeb0db41

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b8d34a32951664b8cbf8d88a6c691fb18c8c670f24dc2158c76912fdf637cd3b
MD5 3f14d67ad06923292cf27fcce72859f2
BLAKE2b-256 0bf316a3cd7a249d32c9c7fb3558f46431b8381d185f5fea691b17788657934a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a4d4f51793da3348ecb7bb87a111b94bb6c30e3ce2bf46fa10c84a4cb9317056
MD5 dc8949b9d4ffe08e6fec760961955c3a
BLAKE2b-256 7231cec828e75dbc6fc81572b91e3bb5e30d37fbeb7726f0c3dea39a1bcb9b46

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3c6826278ce5b9d9dd8099a646ae9818c9a0910075b2045495703fa0925219e1
MD5 4be62a6d98a197bb88445be3b371bc0c
BLAKE2b-256 24097b8a1c07a236d37828d66bb9cb42ebeea48798bc4cc67a47f1a916be4b85

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0f42d95b32ffd2afd0ef94c2308256db6491ad52d1e564c4225de63ac481ba0e
MD5 ee043284d7f0e0d097b0a259ce931a8a
BLAKE2b-256 aa8f666bab1c5f49e208a89a7d83f7924537b48b436614b255b0cd73a8fd834a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7288c0e949f0610c8d04ad8dd56ce93a91f09857a0a5ba721b06e925ad09d7e4
MD5 70a127663f7b007c011111fe4675ae79
BLAKE2b-256 d3c4efc12b18fdce45c6fe1ee7cf49ce969ae62a72c3be895927a3d622994a7e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4ca11133fc7da7dff0809530f790c8a37be097d9049b3a4aa611f24f747c6a0f
MD5 fedfffdfcdc697cb5214fab346de8a14
BLAKE2b-256 9933ab8ac2400a30344330c9c964906749ecce1454398d26c10ee94c00bd63fa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 71dfd0885533f72df49281276347b14bfa4a95794e167a9147508683c0a2ff2f
MD5 a839cd33cb49f59806be86341487c86b
BLAKE2b-256 315a00139676ee8e6406b4cdf3718b6c0fdca6bf5b40b1f4d0e77e8e224e9742

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501081731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e44a68e16cba603c3f27bb0677122b70d9c20e6ca5d1be8cc6f5858cc0429207
MD5 4f498d48646526a67e3d29e862a8c37e
BLAKE2b-256 73b189792b126f4b5c78f5fc170e130ac04332a69f3d22ed85d6735eac7b8517

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