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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501041731932516-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.dev202501041731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501041731932516-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.dev202501041731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501041731932516-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.dev202501041731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501041731932516-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.dev202501041731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ded890f454530f1c73577144f9fd1a04b8545c36b800afb8dee5a7f71bed9613
MD5 bb65e2654f3c7d830cee3a4949189722
BLAKE2b-256 bc89cf25f1e51f6f9ab30a721a248dac61ada342c347ade860a44a0d54edf84e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2cfe76e519743b03f0a08232e8a8757f84fc8e07205c9c58ab4d0a1289707f5d
MD5 078f17c72109dd04874ab58057c02bc3
BLAKE2b-256 d5e78a4d46708f7ca81c1d778a1b701889b5a187f318f3bc31a1834285bf9c99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9ff2bedc8defd65f447317283e7a796089d1341c12145c8666921455ccf82c32
MD5 0626d7323a4abbbac23e6d85121b7834
BLAKE2b-256 bd4bb96d284b131670ed4ba0860c95403e60c54ee65a3ce4b17d320f9bb35c4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f7936d367f885f582ce175d8494fa21d2184f0507e830cbfb5cf790f1750b107
MD5 bd19d506dd138700e157a0735338410d
BLAKE2b-256 bab3c9d4688881d5faed1e797d56d685831341232eabf56307e0343813c175b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 31949ec4a796699756362ad526f4d6d58fce69b390d3a0135bd4ca7958002308
MD5 594f7504dd3226996e9ec2a8dbc15177
BLAKE2b-256 6d5495001b434b0cb3a89ac60afaa7fed98bf4351e20fae9f0e856fce58a5c71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 887aa9ac7d437d3f501781fa12d8e5fe4d1c8eccfe36759d2abdce5d7267ae67
MD5 7a8b962315d526c02b4c503e97c9a9ed
BLAKE2b-256 4a890a90247519453d4a3045d14bf46e76277b1b490092d714677297c7bc64ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7dfd5883546218321e934c32dc032aabc6070dbbf007634a11ba96980c282c91
MD5 6cb1d9681642ddb7256ce5b303f14794
BLAKE2b-256 3ee297d843f1d11e892afb479322038b4dbd3e95078f3a57518079525df74df5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0c2d0275e5fe79dc494385652d9174e51879e942addee2b9f0d2376892cb4840
MD5 38ad413ee8e55bffc1dbc47418d49d80
BLAKE2b-256 2d0aa435a17a78c882a538444f5e2f2922de2484fcc38df7c5761199987b0bfb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f7665dfeba3fcd6bc323f17d0a02fe5d166c377a2175f0dfeab49e0398318a7
MD5 2b0dfe4512e33726aa4650d3a7c72dc7
BLAKE2b-256 e27356dcd18039aecbb18e2eb5507d1bff6ce829600018afa543b0bcce4776cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bfdeb53b1ff7cd3519dc163eb0c2464275e8d5e69cb1f588fbe036be6b15989b
MD5 2b7a727770d62e68f575f95185820b1e
BLAKE2b-256 28624af03dd0b77d3a49d2e945f23d3542a0aa4665798201816af95343d735bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 89acc7d9622ea84e8d914a49cf7f8a80b13cb5b40b7fc000ec942cb195804a65
MD5 b4163e8ae0fe2b92b50e3ffc230dfcf6
BLAKE2b-256 9dc10e3116a2714c4fc5492e15ee1bb0e4c0b087f9d7cbda6956e2845fea0775

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f772e84d38044f6df758053d799c58fa5b3bb5fc05a60aca4b299030e6ebd163
MD5 16ded187f135fd579b209c3a6197081b
BLAKE2b-256 81308c837ad143ebd86192033cf3668368551b1f5f07616dd05a13d10bbb7ee9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d9f2da9a2181b06b749e5eb78976a863162e97b810816d3a96db35aca97e8368
MD5 61b02b79edfb3f5032b6b88ac4ea0329
BLAKE2b-256 b067737c6f6da8ed643bb570c8d15da20b70c6f29bf06c32c50f6c80aa5c13d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d6102a1b2092c99bea6180774e3ccbb5f53ef224a43a11589d7e2a868be11c7
MD5 9a070bb0e8bbb62ae65b86f90dd720b2
BLAKE2b-256 1b640777ea085312f1f197b39f6fdb837316e9a53da45f0aa27f37a62cc760de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2b5c7a0ed9ee91be350b0f69f7ec1f2603e6408739de94d54139d67854d8d2ff
MD5 b2733435afca6efa2691edc79a41a5c3
BLAKE2b-256 9ca0ce2138a937eb0aa81e7bc0f9fbf634892ec00009178f44c35b99af15eb3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dccd49a61ba647835c6d7b0a78039bbbd4d0b4b4bfff6f667c449a2e8ecfc446
MD5 199f69f2501af2e15eaba419cf95915d
BLAKE2b-256 7299a0ae5c31f5e514e32cd7ae34871a8cdf2dc0a59643e1737947656e9a1e16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f1c1e0365b71aa6d992331ae4c7994485a55a6fce83981b85f4f29e262216d6
MD5 d3ea0988f04a7083baa190087bd3418d
BLAKE2b-256 3b35ce3d36b1fd332d113fa379e6ce9c59305fc02756d1149834595f17411d5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 936f83ef18624fdc0bead6f49238baca47dd463963ff3ec89529a7bac16c7aef
MD5 f638d5e633b6d3c12b1746591fa47281
BLAKE2b-256 2a887caad037769156297291570431a9fbbb3b921a669bd517005339bf806441

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 99e14afefa0086851474ed5f728a580ac57f698d3b45406ee1d6b25f38ec771d
MD5 e458f9b8ae10243361f9dda622f16a6f
BLAKE2b-256 9e20e2970f499751a2aed100cacfdd914b5c8931827268e88c34606fbb82a4ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501041731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9c1e2fac1870309a965cc376a76aebb7bb57ba9eb5040041d8413a7755a003e3
MD5 1ab6509bd7c23dcdc82ce72dc0f661e3
BLAKE2b-256 9fbd1f3da53422efb61d09d630a6e7d5b13d5132e378e312beb5cb1741447045

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