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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 10.13+ x86-64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 10.9+ x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 10.9+ x86-64

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

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202503211739452835-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.dev202503211739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 130a060bd72b0230cd7bc8c0991592d5d20303442573561ac373ab561d64cc6b
MD5 b308bb2419600be766a53fe5a47df424
BLAKE2b-256 b879e29b5f4b34b89bcba6640184706b0c4212e2b118fc0dc99e0ea228d0d087

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d8e01dac718eff23879304c75e3912c9fae6fcb8b2f170462f1eec685f615439
MD5 209d9f3e3ed4d910e043bcfa1806c91f
BLAKE2b-256 4892411f29446eef5af592a58ffd8e092e2f4494b403bd32f94cf24157f9ae31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 85896c47472e95f83513a0c5e811b68945b1ba89f5c64daa959bc9b9598a7489
MD5 0a2a8b189cd437b57c3e7dbdf56f6f3a
BLAKE2b-256 efdd557450ea2c2589edce44a869768e9303cff691b2a3f75cb970bc82b40445

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1769f091804af2d552978061a9d1d8f6b01151dddd2bbb9419e0aa6638ae079f
MD5 7e89fa363384c4acbc4a41bd29eb14b8
BLAKE2b-256 f998f8c6c2ff05a43faadbe438abf6cc176fd251a8ae7c102c25bd3b1be74daf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f848094e24cd397a7493d80d010be1e1b18dcde6d6fa1b461e448f7c454b73f0
MD5 9691f70151f9f6cafaaba35eebc69193
BLAKE2b-256 fb8f48476301cae3a3ff883e24ece565b5c07794a08a17ab4847b9ee96da29f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c51b60d88e96754683f073a837e098e53c3a39f9ff3697a3dcfd9e58c4b23e92
MD5 6046dbf814fc89975a6d6021cafa5c16
BLAKE2b-256 0ef0bf419e4b205fd431d046edcd57398dbccee78a0a5bfc01dd3d041be95315

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6dcd78e2a42977ad4499d0d037731c160bf0863ef63426032f64d86eb78454c1
MD5 2e98447a742533b7d5d57c2bf8fde951
BLAKE2b-256 3220b0ac4aa45b59927b6b3862d7aef70d27f4157a4daa681e30b8bad2badbfc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e4adfdf32785bf52a22d896105842afa48aac13f288df99c29b1aa2d97186111
MD5 0be6a96b165c376bb2fce269857f8ecd
BLAKE2b-256 542ea18f577c5840488f131c0a62afc904d837c73c68f2e45f24941b9573a6b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2716324b1cd420ad3cf7430edb0edfc547e49e3bf590e47fc6fffce7b04837e8
MD5 e5466592a15af8932d53ef821bc97e90
BLAKE2b-256 4d6311ca68dfba3f428c07a97669cbcbeec46ce20621212f11252fa14f951d79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 554e94800d49cf508d8520e0041ea13c4bad52537d4e952ab08a37275cea2e32
MD5 39085f069e7e5ae807bf2803b6140a5c
BLAKE2b-256 04b617de9e665a701ecef5905ba7a0acd9e8188879709756456a49dcc0476172

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2d28fddab941e47962e3db0d91dc3da170fb2a961afec9c6c8d8156cf5ad166d
MD5 f80c79a0a6a347a55329986f8c7384a5
BLAKE2b-256 3d7c23097254652d4412d91ddbfda54825a6d5238864a64cc6542c04d68e8473

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9319d30b8d869834c4c1e34b6865233e2f4af412e923001cd523381b3acf066
MD5 352c3fc161ae6bc2046a54457c4ce622
BLAKE2b-256 583bf79115853f8d74fb1168f04922cc1381780aa2b357404b2949a3cc3c63de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3f580546c437c82cbd9ae0f61b2152f6e7c68838ee929457e8239a5a3e46c513
MD5 871e9c8a7328223889c97239eac13139
BLAKE2b-256 39f0b5e9a95f066c24a0bcf4d15b5bb63d8c4eee38bf32e10b51443d1c8691bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8ae7131cb8ebed5455705185fb90f270995620162e7c40a697baa721080bbf4f
MD5 962afb8d3ae2f636e546944ec9d1d510
BLAKE2b-256 ddc0ad40080fe7fef96d919755f7101fe7491f527effe5bec63689a6c43732a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bc1ba0d7408ab9f82467ac38181ff60c67bb7017bc5d19225e1b51f5f419695d
MD5 9e1dd4ac643a7e214923491edf107ecb
BLAKE2b-256 f72788c0096079a6ab8b40de59a80ffb3f039b2ddbe3acf1689d6ab713d41c8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b99c33d10e5e774a6ab44a4ae343fafeac80781653b0cce33ac737237a25d255
MD5 4f5d162f09865fdc13a4609c5d3f5651
BLAKE2b-256 accd6e25d72b52e487c76fc80fca04e76280f55f5e740e4976034f47787dc781

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d87383c429e7ebbdd424ed586da83c2f75980b48ad1fe46b7dafd1ccc30dafe
MD5 4aaf2f967d14fc947b335848beb6d679
BLAKE2b-256 1151f44521411b274b7ea0c09f1345a84073564f7a3489e08ea1b495029392db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b4cace1d52475b3a7a9cd380b9d2470e18ada103efa86b1c1980e78594dab0c9
MD5 e16d5a87e0b0158f596d50e6f3dc2c64
BLAKE2b-256 85a01caa38f00609bb30d6c8c27c017e1bdbcee61e0cac52764747b95f79d648

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8dcc9528727444a80d7e45a4d926743d4532efa813024174082f115744ff09e1
MD5 1b048f250755a4d18a5c11ccc1e6bc52
BLAKE2b-256 f51ef43c06b347094eb34a35a144ef1cbe1c0777e0ab59d54a435f174595c63b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202503211739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 839745670230fcfa179f4530708a2c6c7b92888b5a191771879f6c998e781a3b
MD5 d5cc006279961826d75bbb110d143f6d
BLAKE2b-256 64342c67ae7ad60dc3bca83a15bad439fb74fd15b56a43f60c8e2819905948ea

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