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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 10.13+ x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 10.9+ x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 10.9+ x86-64

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

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502081738433769-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.dev202502081738433769-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f6625ff607a06aadccd0463dea6fcb054fb76c931345c218df01fc7e6faca462
MD5 b222e2dde2673bb3a9e70d66258aaf37
BLAKE2b-256 472ad6571af0a8cb93cb5c29eda25684b6cb37e6dcf29413558c22857ec9de54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 096e1ee50c0fb93ec648ebe59ad5002b7ce14958b8478535cf5ad6f03567c1ce
MD5 3f9be107b743f6c4d53049791efbd599
BLAKE2b-256 788b0ed1e92bc40ab5f8ea0628337c86be970c0ba0b1d2b919f8840008739d32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 41c53b54795e92af2c5cc0e296be37b4c5e5f00dfe1c175d00a7db02033a0a94
MD5 9cefc6927eaac6ca61082fc2a293666f
BLAKE2b-256 6c8a57475d042f0edf3ca60b3d32d63e7b9e5b422966073e006c93c66a27bf8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b805646feda5227d7dbb5641f2ea2049d61ac9cf029c019e63006319ef010327
MD5 525560114d246047b91f0bb2cf9069f7
BLAKE2b-256 b97ac1d6ed72a8059d3696318e2f425f6ff3f45d355864a66e67d0524d75d9a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c17a672ed4154a195690024cdae6f8fcff33f4c25ceee568ee73a0c0fe72c0d7
MD5 1337af795ac34a3082a567247d127269
BLAKE2b-256 514cc5ac8a2e4c38ab09a1236be54da9cfa5a56dfc4223d05809694606ae5fbe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0f59181eb28c6db7e4d27e4e6d6f101450458238edc2bf1f32aebebac9a382bd
MD5 25bec4bf4791df6b0d592875d89a8a5b
BLAKE2b-256 0cccd355ad2337a63a1703888ebdaedde289b7e20b4667afa5b68d32472196ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06a4c35ec19e77ee01ef5d8d7813196c043dc154e1d452fc97edde6902539fd1
MD5 f329566b863912bcfdbf7e4807727c21
BLAKE2b-256 bc15b23c5f50ba8af37b041b3291a92cff0f071086fe0559b412be02c9736f9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f32f4da56f9398f83945bc12aca85099ef61729e4a6f9beeae4d253c1a94c045
MD5 de9990b9084dcefc4df633740f2889aa
BLAKE2b-256 80aaa8a40b82f5e17423d737fef6f07f9a96ea806b720d215f1a3e2e36800c90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 69cdae7a2df0584f3e8d3957136c6f17853f691ee221c961132a54e2445ddcb6
MD5 cf52f657f50312f5b60749acdb23d988
BLAKE2b-256 2039933da8f5b8c5ee645820db6c8faf0a5d9f602df6e3d4dc2b84e8958ad5d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 927f0c9773f2e9eba73a86fcbce893cb03e8da6c924cdf446b39a7e1724288ad
MD5 0fa5067c101f3cfe32e7cfe16dbc9a4d
BLAKE2b-256 d780666470a6cd64fa0a5f26f419ec0a506bce376b6b7d55816916f54bece41d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fe422a225a874005ff44423e236b5d873a9d90a6f522f72621380822c21a2da1
MD5 46c3221e7f0d33671638a4292eeebe88
BLAKE2b-256 ff0a704745fc19e9f2aaf722fdbb3c66d8a75e5c07c6d63674ffe01e3a2bc3f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e652c4a90ede8284c3354e6d9bd3d5ce88f4d6618fde2404f2851204dd7f0ad
MD5 d23fca16e8ac2061927f2294d516dba3
BLAKE2b-256 2911888468dca880ba50a79278c2ee731d15643ef860f1c6c385794547baaf13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 182b8d4dc7ea5552dc58f16efd0ba57fcd5467c840e7445230fe3808d37a3421
MD5 a18f4fde41fe1b778378692d63c49392
BLAKE2b-256 db0021284fe73f3667e415a2ed513a099ce675b42907c3c40681aa90cfc03124

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2618809231f57b04f83bc41ca9a13e28de35d61022327e8ff666677ec2385f2e
MD5 ef1407534b17e3b1231c583622c14da3
BLAKE2b-256 2a0e6b57893433906d08d210912a39b6d7807a9ec8fb045c67a571b15a0565c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bad6db205ec84ded3b60e317548f82e4f75aa796c37b9818bb61500c6ce3cfcd
MD5 776e1ecc48469219f08bd7d661d249dc
BLAKE2b-256 b7f907840411486af40df79e6c984281d236e409943e8c58c124bbc9c8e01887

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1cc55c1812f2811a93833209167720bd80721293ad166d1cbf6da44c9f01dad9
MD5 5bacf4a5c6170d55bdad2f940d0da3e1
BLAKE2b-256 0edc5d45469fe25418277e60f05be6494e73af0c850f2a52dfe54a8b2fbd865e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f9a74a374ce34ce52910156ab2dacf7971513aaca9be2986ff5f62c1f3f2c1f
MD5 e9e1370007cd24abfec72fef1ead9a23
BLAKE2b-256 ff8db4de74855509a71f8ae1120351245427a6e2cb6c548b1077a8481ecc5017

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b0295d75065554a3df03ed423bd9d103358848a14744ace1a2b81223401745e2
MD5 6755228d3bb900cb637090faf3cc723d
BLAKE2b-256 b248e7ed29da45562d261b0837d403e05e1ebc0b77b352dda7e7836ccd751ae1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 666910c9ac5b021c7c4eb7d58ddbd316b86ad2008794299a083108a1fafb6946
MD5 befc00b0a9a9503f8837518c558cab83
BLAKE2b-256 6b21e6219b18b9daf52953df9cb7a43ee0689f0196e12b06b9bf313b6d8d46ff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502081738433769-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 46ff9a06c62c56c66b09a0e54e9d5ef6bb62414bb567481521b7bb5ecd9f02d0
MD5 3e6e0b683d197d114f502e5958db623c
BLAKE2b-256 2eabc398ce4b015ee5234b7627d6e120a6bcd1c782e3760e5d50b66285b9e442

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