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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 770ef81a05db7a22a3ee6d2110c5c33742816ebc333a8012b135cd94f33a06ce
MD5 961ca384a1560323c567d6d99c803de2
BLAKE2b-256 60f4c340e5c5bdda7bd55c7b4ede2468d14d4226d8160f56d3bd8d5a2978cc5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 adf12142e20be152efaa84d579d7756033c6937f5d8a40fa6c29eb1d80cbbf31
MD5 6368936d745f840dfd043017841354fb
BLAKE2b-256 845785389ab39dc1352238e057b6f7c3ffbbeac9f990544f2304382ebd289006

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c7229867131f7d8fcc45e610a699a9fca0e03e8aa03806591328ff8b91a1a2bb
MD5 92b534c43217313e14d7a6d82bc5844e
BLAKE2b-256 b740d6718e4a7f14ec724f44302d0e1b3c1534d4b7dbb970ec3d5d6da051ee96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa86b6039764ff27c7c50d9e595545d16aa8b347e3f980e4995334d934743abe
MD5 ab5b3f68d300092ddc6e2dbbe236dce1
BLAKE2b-256 7fc616dedde026a9f6c9fa623a28bfa0afc4f39e6690f2afc92d7902c08487ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 aeafc056c4a0d59acb751e95e1012f498f8162db3cebe273cfd5ec55460a0c4e
MD5 a7757b7a489fdd9b22d75bc04d2e0cb8
BLAKE2b-256 0be0ecf400dfcf55f515144879693d6dea57f1459e6055f54fd17b192e534180

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6ee74212cedcbc70f10275b5d791798586c31b41a682e10cc5c543e130ef9064
MD5 d559ff6fc8312bdd01c9b30b7070e566
BLAKE2b-256 a417e4682e64c97c62b82d15a387a069985fc991968166a515759f9f6f76113a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a331792b9132ded2f335d52c293602831e4e7db22faa86790c512057b0330ee0
MD5 6cb4e60a759379e389121a8fb31eb6b8
BLAKE2b-256 1749b1a2520dfc14de9f78bdd2f066ac5f22dcb42277089d2394012fe51fa630

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0d00eef1140b41b5e90e2df1652d5b3349a92af6eed9efe981c9109009d124f0
MD5 79b9a2b1225b14a4b2eb36b6efb237d1
BLAKE2b-256 66aac8be9d74c24baf7b152ebcb21686c268938857219acd140a5a72b47a5eb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7dfd4477e4bd5e6f23150cf143894c26afc360e6b47b18dbb4c02393d614f98f
MD5 cc2f71bc1a2d7066a250afd63e115754
BLAKE2b-256 d7ba0a038349f1303064eb3199d53a7baaca523c7c2a391804152cefc9b03c19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 beefd8c1f2ae1a05cd67b9968f6b94b341162bd32f9b4f0df511a1ced4fd2184
MD5 bf5bff34e926902fce7ae97e8d18cc17
BLAKE2b-256 7accff08c987730e0191cf29ca424ccc8e804967b85301b54fd2eb8ac2179dc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 73cb17c332ab7027893b37e16ff215958a1fbbed1e9752916c8dbf8a93b73851
MD5 92b8ce9894de924bb2e46df320a22d42
BLAKE2b-256 aa85502a79b00f86e552af5073529ced4cd0212f8826f07b0d79fc98cdeef4f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2cd365f87caabd1146b46749775755bb70d1b9d28a7c07ba87268eec999cbfb2
MD5 d10ca4d64aca8b97e93dc4f6db34f918
BLAKE2b-256 de449fe45b47976d8ecf83cead0956aad42a16cd5b0d569611f111d53097b103

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d95321ed4446a79b31a449752eb97c048aba3ce4f5504ce4c0289459a69042e3
MD5 a3a072850f6991da5b0a5e53129c53d6
BLAKE2b-256 479f0eee5d5aa546fe446120c32e00e5adecf088b9ac1ab8c6f5668eb07ce263

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca844666b51507b1b16f96d9fde98725e9eb1cd50586f25cf4ec0d3711382a94
MD5 ad47e7f5b4002427acea745aea5d1901
BLAKE2b-256 953eea2466c2af7b55f27bc2358404aaca19f5bdf345e37222d2b075b60520bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b0597166cb2a6e2f41bc1d620ede69dd427ca76c0dcc2b037cb30d3c54021c12
MD5 9f9cad759efe4bf2a076ba7f5978b098
BLAKE2b-256 2399730a0ce67bc042787a2c64c613b0ca60d3fbd2ccdc424a0da786811936b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 112f74d21f4eb63dd6c00c5e5e5c40ec8c3ed82413f87928a7a031f036b03385
MD5 1e5fa3a9f97593df4badeff919a24ca9
BLAKE2b-256 855847b35e8a58f4da04727168f223f7dc8c744a04aec434da3090722065ff01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e568fab019ff20edb5de944b87b4fd44281931ac9aa287fd631e5bb427f78b13
MD5 62946f919c092a51efe684476c26f6fc
BLAKE2b-256 22eb2957f6a5a1f9959226f1975d65a043ed9ebe70939c8240ed559b273d9b55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 99bc250c9c37b9e43d14e6e83b92ef5f218f6332480a1c40770ef7142c7637e7
MD5 427dafa38221b6f18bfaefd9359ecd64
BLAKE2b-256 941a6595c1646e0e88650bb217c8d32898401abc926296e2e77c23068548791d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 568e175ec652db118476ae1e9faf36f8b45304debc2d92a820caf523ed0b905e
MD5 9b07dc87066ca22d7b69a03c3467ed3f
BLAKE2b-256 bfc318a82c0a95214c1465085c2bf13766f88143d57ec050b23c5e4a59f1019c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412031731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f00863ab1cc115923a66afa7c39ee9dd9b7ea66161d2f44f78c05811a6d0686a
MD5 a58b86889a16d5971c275c2d867b49bf
BLAKE2b-256 b8fd27169e937694f1c1e6606acf32f0aa57b57334ff2c8e6ca7bddba918111f

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