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

pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c8ee9785d04dfee57a2d85784e5c164e2a976a38931e8d5d55a4258b2cf9cdb2
MD5 a4f79690feeb4851cf31834374fec12f
BLAKE2b-256 44bce005dadfa3303896eba6ae811f6527f1058a6e7dec6200ec414f77e92f75

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4893957536db3c2e514adb91042614b8958d3f4cd32cebfb2d78cd9e85af60fd
MD5 b66aeb1d1993f4cb46973ea0beade5c1
BLAKE2b-256 e8ee6a30fd0eb2216ebf13d8d110c1314ff6d712de99ab34ec53a73827f6fc59

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ca340251bfbfa55f372e7735aea7d6bd346129c244e33e163d6612ab45817b01
MD5 b04a301b124e08b280b86124e7727452
BLAKE2b-256 ef62927a2cfe7554cc90b8987c5334424601ee8e3da804bd5d314606a476c8b5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 afe171d7b395c143cbf999fe31e16713dfb220f618e9faec62fbf01c7fff4374
MD5 802689843d512131643def9eb8d91480
BLAKE2b-256 f0539ff3406eba0ace568e1ed193e071bfd4c6df6ac507889a05151807683048

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3652d880149ef8c9a566f6bd71b44292afb2995e149110ef36febebfabf29684
MD5 a705fea5d5fc8ff10a86eeddb1de46d8
BLAKE2b-256 ff486397e1649e29dcd53e46f0980334210f4c4f84b1ae2cd7d2d9a9557f0ea7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8f8a2b4d316b643f9a7a7a5503dfd5e48715323b6eab49c99bdb868882a0b93d
MD5 731ed13d174628861cf37cb7cb6d1946
BLAKE2b-256 4fb5126e24af6ad52338fb7464484308f72c357483ebd176f12ab72013728d76

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f4eec778c529a357b69ba1cf5ab95d89f84f052cd63060d0f5fcb0217dda8811
MD5 ba540bce0f9d43a5192641f97b78be06
BLAKE2b-256 b5976bd8ad68027479bae401ab2d1e030fe4d1023b453d704953a2f6d1c9eb19

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a11a7afb4312b6d5f8946d025801be984fc0df79185661a7db8daea7ae0180c7
MD5 18836fbbe68b967c14ffd94cd5b110b6
BLAKE2b-256 453fd9e269f57c0a5fb3fdf6604108a004e8c595e8a2d3112a26e9c5ae1e1c8a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d9c850b6a7f742a39e9e00428081c8079275497cb58e31d55461416a23f0ab92
MD5 d0b39da208e2775d01522850402c78b1
BLAKE2b-256 c5372cdb8aa028826aa3eb8e1f92bbe8c96d826a234e54e15294e81587a96d7e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c0dd73e3f1df5e6e2a7d6540e4b5fb9c7c632accc6689ec59191a882b9f42c0c
MD5 9427e40b405f06eeb851e59910a9e469
BLAKE2b-256 4a0b4f19b4c7c6db35b309a14f658868a9e84faba6f719e78e28a5d3a91aa2b8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 714c8296a1118486acd2406922f2a47146ad5082ae70be8ef55791f7c7b37d94
MD5 72597564e922d39df0d314480521f194
BLAKE2b-256 855172724b879105c77f090e10265dd0fc84d8b544be4b954a7f4cd9ff0a48bf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a0d12fecbb514e43695218ec74fb947c2d5baf17c9204d3c59fea2adb37a7cc
MD5 cea1a18427b4abba0a87cabf673e4f71
BLAKE2b-256 8325ebbf60f0af31c5d3d3bfc240613743da23cb2da1b9b81cf8f43291c3a74a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8951eeec7e024024330372fdd2f3e45ef4af925169d8e76b20024add079ff08f
MD5 020d60f58dfd8c1b8b0dabfe34e1dc1b
BLAKE2b-256 982588ed59377f9b1328b2df109470ad2881e083102260c49bce050aa9a16bd0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9615ad27023788c59064cb2de4f9462e639f7ad0348bfdb6144bd7664bfc12c3
MD5 858a2e714395608a07a6df15a8cb7cd5
BLAKE2b-256 e244fced8bbad1ed9e5006c65a0d2505d15ca30da1c4ff8ffaee68d3e4aede0b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 68d02a2358d17abc9e5d1a1100225ca708b2600d56c8b7f9d49ee09bdc9c0c01
MD5 10df320e642699e387d8231682af580c
BLAKE2b-256 f4f01bb5bb007fa64742937635ee1921e023f27896ecb6a96de67d11db0cab3b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9925001d9acef2b6367fee02efc4024fd57a5ae287c2be3667d1535a3aeb9348
MD5 14015100549faa98dcc630e2950b4e95
BLAKE2b-256 2ef36893d18ead753553e2b656a1f430c066570f51f8d7147874c8d3d772a627

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fcd83cd8eb88826771ce874fd6964bd57a63bbec19015245c86bccd4dd00846e
MD5 d9122c6351e684e4fb623ee9f279530b
BLAKE2b-256 ef69563e6e0d847f3bd86840d98b75e74b59a3d9636822d2538e1df13e9b0ab8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5a84c23022a7d385f5fcf54d10c18cbd5bd4da6d8aeed0532b526e97f83a0b56
MD5 1c6db53040bb2c67c9f0da4087e65220
BLAKE2b-256 1c0258ba99674ee4e0b62fceffba04c1a2ced85ecd77d742455ab1b0d9586901

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02dbf10fec5814f2ce69719e41fb3473d37aa7020b84d13b02b51c3c2b70ed38
MD5 696cd97e9240497235008e1e5849e188
BLAKE2b-256 3ea6aa7b1c42d5c3f6f291189cf5dea0ce0fcdc4f3de6c74e3a2e8758f5fcdef

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409031723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 86517672575af71f321d3964401099679efa6d7c2cedb225b45513b8c5f60c9a
MD5 fc37c3bf038c1965c9337964dddc8a60
BLAKE2b-256 fa30192187264ebd4e7d98610ed5897d6cabc32bafb1b0d568eccc6285e4b1a3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page