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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7900e6990fd9203a4b83c4b461fdcce691005a8dcc28c1d61b45fcbe51b0ad22
MD5 2163095c0720431731264ae6c6f33cd9
BLAKE2b-256 1aecc970de28338c3efd284d5cf5c8771ae9d49b529e763273491ab605f199d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fb6f9bf2794af94beba9c51cc711eebf6f6dd5da8bfe84ad068f24bec3060f19
MD5 97379233bfa52a0f153369397aa0d229
BLAKE2b-256 cb265a9e2ede6b97df8ae2d64a0a29ba4c32fe0b2602e5674bf0cd4af6bb275e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 62ee9f74fac0dce9bd717374f299ad093558be6613035537d6a82d97313b90fe
MD5 0f83db8064510ef5333aa4cc40f6b8d3
BLAKE2b-256 d779ce003e76a3c931d51ca5c8f53da8a1d05c8fdf526143af67d2c2f162070a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4da74e9d5f7042913fd538515f13fba09903a6307cf526c94cc6486195c7cc94
MD5 f2d46383e3188622a4697ddeaf3517ac
BLAKE2b-256 744ce5e25f48255d1e095559fab64b89f1b0f543215d2c836eeac97bb87b51f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 5da49f294f535e8f5b499b012b868d5e8211c3ce3727cd16070d7dcf893e4ec3
MD5 09e56a6cee98524f8832ce580c05d5de
BLAKE2b-256 8114e7aa0a673d76455868cc4d6e817f5d851df1045d9c77d54e0a0685254902

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b97b3539f2af66f3dcf6da1c20f06d667a4d3a6c6044f0adb839ae69430c2265
MD5 75b7c41d1614b2ca0b12bc2de8cd4f99
BLAKE2b-256 a8208d4d3f125f47ef9fb0c30229ab047607a46e557260b66cea6872b6388287

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a6e4fa18893dac8fa688e8900ace422daf5303d65ac56e0ce74e49cc906d0341
MD5 e3715ca1b9f2d6417278be0af9e3e0fd
BLAKE2b-256 575589387abb449c59c4de33581a74ad83f892190f39f258be429a9cebeccc1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 98d3ae75404a6ecd2a56f0472b7604ab1e6eca91d3c70ab84f4a97ee284811d3
MD5 c9a294c01f2160c30afe53d86fb428e0
BLAKE2b-256 b47addbd290e70ed7f027f7227061c2f2bc7daefe9503b398da16011fd178f09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07780556b1ea7b8a091be67a512f1ad2a27687bd3d3ae7812851e763212b5ec4
MD5 efc48fc6d629931c80bacd3ae2571054
BLAKE2b-256 330b09ab3b66b7495ac6f04542dfa632c564bbab2d03dda9ab4eecf4642a0277

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f27a491dd1b2906de917a96475c6e74f92e715b42d43a1a36125fcff68dc578d
MD5 38a78b862682f0473a820498245e1037
BLAKE2b-256 00c50e88db3e51221d9a87bb87f0983dceabe1c71a5562d5ca021cdbda1ee99c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7116f6eda98a26fb732c65185c120d51a423598d188982a1621cc685242cc6cb
MD5 c2e5c4aef184c0701ae30fe0c36ff6e4
BLAKE2b-256 3d6248c133de8c0441cfc5444f2dbaa82f9f677e279cee81becf0032da48128c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 20abf99292720ca2fc39f59f625cd14b929781b1bb3bea47db08fcec6994e24c
MD5 b846904b9b9cd54161d0a06b170e7142
BLAKE2b-256 1d9440dca5471986a654b73fe62eca857edeeeae58ad61af838592c1c99189ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 799a31d4e92c8073945ecf2d24cf98f82275487256e3ac57c8f6bf6dc2b0df11
MD5 1d805f7b2dfa482a0d20651493cccd17
BLAKE2b-256 0dfb2744eb3f4c33f5bc757993b99030ad15bbf4068d702db107fb6bb521ebaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d225a82d42fe5f0645217a1eef62ca8d256b83fb7145d7f3a7c7551aabe4287d
MD5 c8cb5cdfc71a3a2de34733c588357384
BLAKE2b-256 40dc4b5e385558ffd9a817c1eea9206b91a047cf0579081f82793ed3804a89d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d49fcf1ee4ef92b42f6cbe9927ede6bec137c8766f5795b4ac591f9f7188ac19
MD5 cdafa133c652662598855d96ea1280be
BLAKE2b-256 76659cc9fec177b7331ff08b1c61705751ceb7c1d48dcf8d7d20e06d103d6110

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 414481551a9706d64dd67d41349a63e28f1f943ef0e646bca206f20976f0ba65
MD5 4c19ec65345da4542e2ed4f6727e3600
BLAKE2b-256 95670f2d11b250c319f9a4f941f104915f265e231a477e9df341b2b2eb57dbc8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ce957a10ebda06bbd088c0b04c74a32d616f5250841f797757259da204d6a9b
MD5 52ef0f201e8b4d2bd2c0096bf5c3cab7
BLAKE2b-256 a64a7399ec8463c5da0b0e0dd9b681884332e4f1f96d7497564a80d0d70b6177

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d94d2cc5d61eb35e0e01804c346a9194e151c5bdb42284ff09929b2a535f5179
MD5 fb847a678927869b917b46f54f639bb6
BLAKE2b-256 fb625f197369970b86ae0513e0fe3a487d68c0153eddc6376514506bd57b44da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9610dcb76425250e8a19c9df8c4b052ef793698452220bb3598b793040969e57
MD5 da9fbe9adb756ddfbe1134a9d3378915
BLAKE2b-256 ee354c278b4baf093102dbc2840dcf4128eb501c2241d91af23b3433f0411e40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501241731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 47c370ccb5534d6fe7650755046b479c63f7d78b13416806f0874ad8ca586c1f
MD5 6f88ee649f1374859aa99addfe6fa3bb
BLAKE2b-256 f5d092cde60e4930a237e5a98096ab7246e344fe57719d298a17f1c5935e8ba3

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