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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407171721166532-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.dev202407171721166532-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.dev202407171721166532-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407171721166532-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.dev202407171721166532-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.dev202407171721166532-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407171721166532-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.dev202407171721166532-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.dev202407171721166532-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ceefa30b67eb62b6b8bcb07a63e93a61d3254ae92a45a8efa4ae80f233d5ed57
MD5 b5998e967d946d67862379b21e90c3f1
BLAKE2b-256 a16b29ba3185074deb468234b6a40d1c740ab8802928053c69b2a181e9a595c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 90aa38b31f0ed23b19b357c81e7c500691d3d0fda4b67c01a0164a723dc22299
MD5 df2f629599363f2661a1173338c8e33a
BLAKE2b-256 64646115f0524d141d208e46f2161a06db4c0aa101b07fe962377b794cf7bec8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e157ac905023af1a0b8dbffcd60d3db6f8ebbd0686318e117b09aae7a95ed8fd
MD5 c55e825eb72897b08cb2afd81b05f82c
BLAKE2b-256 614d0c2e656ad05edaebb185412813223e53900daf56b8d7920e41839dbf54f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 870f2e812b51b45bb2f55c8334b25af8e0828cf64b3a6115fc4038f25d1eb622
MD5 9e443918759733171498db6e628084a4
BLAKE2b-256 bb727252058ec22686d8a4f31569a676e51e74745f235a8d0a0ebe8bcec34edf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0c7ed1b3b2da41b941e36cc4dc8dce6def6fdde78aefe34550217153bf35a820
MD5 54cbc296e7070dda8084caab38ce5ece
BLAKE2b-256 1b7f4393148b488115733d252f28bee218f2b6429c19280a38470482ddb1f245

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f5131a27442ec0f9703d6b9405ff94addd67f4b19742500953bf68d7863d62b9
MD5 cbc6c01a4f82bf1e852593a78f4c9bb6
BLAKE2b-256 0e24f51819d4bc047d5103f02eda8c9a1b435aa9e145ea85e39b78b4b08ec3fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a3ea3aaa486163108bd53b7b6fc4c1b6874cff360703e90335e970b175406d4c
MD5 a2ec2368ffd8e9913f4e71f7b6b66a93
BLAKE2b-256 2cbdd84b7dc975ee123d5a47047cef7015602e480e882ae3153a9f0a018ca61f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 525305129de3ce6f6b3a463975ddc80c9465eecf01694ce8eb5ce67cf7d8fb5d
MD5 a20940cf6e24e53108ad10ada6e25511
BLAKE2b-256 99ba36e3084c68ef41c4de86084e4ac7276b992b69b67d63216092b53815de6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22c7d7efd0ea4c4da04504f360282fe1134bbf7b85eee455184b29d60c887d70
MD5 91d00210ff8d2f658596f5baf2ffd21d
BLAKE2b-256 ac6b552096055e2b7dc20295f7d80e5819c5585b763826a474311d89326ec057

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 640e0c677f9d369f1cc7e5918d34e46ca93b37a7cb0be72eb523b0948a024b39
MD5 5092fcbaebb40e7385b7d8b0a0906361
BLAKE2b-256 1fb9e33585625f2078522beaabd37aa411af729ed395cc7875589418a839d6d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c3a14f0b81db026f3bbb6180a305f5552a16dd64d40e892821bf4faf6f9686d6
MD5 d2d3289aa50b4d2f75c194544c51cf8d
BLAKE2b-256 d310f9316828cc2c59a0ce810798b57dc069805acda47894ac6cf270ebc4cf7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0737c089c220c76c20ef11c420a2ac6e8391e8c2dea0f8d316069f4c720f4318
MD5 2c8122a14f7eb3ffd3f2c06a5a0fa092
BLAKE2b-256 3166ab0c2ce66dcac4d1c45b220aa6ada52d753d58a36010a7525a9f22ca89a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1c354f9b5a94e5514897410841a74898ddd053abb58489b504346fbadc712090
MD5 0ede01538083ead38d77af6b7f9b3873
BLAKE2b-256 36faed4f0e8128a5c0a2077edd4471816f54e9469e486bbcca47069df225343a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6345e3fab8e7de97473a1166330cce40f3be58325579c91ef545c74bd0c7caed
MD5 a69488045bab39862976941bc6d5b828
BLAKE2b-256 7bf6f7945d0a5a6c0ea88dd998da34d885b3b0bde70512746478b75ef625862d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2bc025db8b030bc6b06397c6bf493d1d225129a646dbc33513fd333086f26327
MD5 d3a34029fcf5990917d6fc6bb212accf
BLAKE2b-256 4bf9fc1391bb0ef84db1bbbfd53def4d1251fba27f94be7349b96f305ebc9f80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9730b3bc64455f22f7ce313faf76d238563f022da88d555012abd57693bb9d60
MD5 e8d5f11393440f0000829cfbd7ff71e2
BLAKE2b-256 f1bde21773f8f324c18a02f33dbc791c8ebe8c2979e4aab806b658f17b9394b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9fe09e08a4b3e34a42d7920e5733f72bc224f55fbdfdf87c47ecf11cf9b599cb
MD5 41ca95a27887ac52ce9da14bdf9e46c7
BLAKE2b-256 6d6cac975fd348197f851fa2311a418f3712d515e753b31ae81d1f7deda2e810

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 90179e72b3fa7550e11203b1e8a81cefa141afcbc3d9a4db9e57144d36f8c4a1
MD5 2db528687939867af2dd4fe756b1cffa
BLAKE2b-256 1bca0cd35cae853d49d932338a84ea0992992e00827f696bd3f0ebc2e5525e2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 091d5e6593ce9307f805e158fd695a08d28d071451711cda89ffb283e4c2b804
MD5 c0ed05df54e22e16a8da005d5631063d
BLAKE2b-256 8dfef13ac4c9124b2b25cf75a45ebd51ec4794c979ad4845f474e71193a4bc3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407171721166532-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2278673aa8127d819209586d3da2f68119407c72e5ed2ad2818e1ed1591d7f89
MD5 a18213d03adfa5ddb62f45cbfee4059e
BLAKE2b-256 d9e1b060d4587723ad7bcbb3bd6002cf2b806319eee953f13a5e2cbe42044afc

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