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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c0bae68b899b6be846b4ec5dc4af4b46c7029794e8be13a21a584e17b5e482e1
MD5 12979be867a0e1d260329cc46cc3000c
BLAKE2b-256 d91abaa7873990b0e5ffda3cbf81aac7230f0c7e824537e700ae4ed5baa79c77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf8f16c6be10cef7d8905b679d7c73a74b2e90fd7f2d50b24e802e3aa57f1267
MD5 739851eb8a88b3295e21a7604e9a8dd8
BLAKE2b-256 39c4e8d1c9ad62ded54172a1c810863d70bae00bfeeebb77db9ceb2d2c1c36b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e29d19099a9c10bc3d7a4aa25a868000b4e760bfe35d9a780ca9ee5f9ea70297
MD5 740afbe95db56f6dc6293d0e313eb217
BLAKE2b-256 84efbbf90fad27e039077a975eb9634d45a796ffedd4b561b4cfe1364ada09fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ca412e99102fe54767af570795ab3e17377972a199099b975589942e7992f78
MD5 b5569e3293c39a6dbb8243549ca0d671
BLAKE2b-256 c42881acedd9045a40f40f12c09eec81c635c278263157f64da18d910deb3dd6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b9d34b054cfac107e3526c4acacea599545da00e8520c6ee85de76b9d3fd3466
MD5 b6002eb1d1f0d9c7363fd4165fa02328
BLAKE2b-256 35d6258ebf8c4a3ee4bd0473bb5454af63aa3a4a5df7ec13390140cb417f2cd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 db5c2806a256c85ba80064dc8c1e08a75fb6beac19c3007ba2458f08c6372aaa
MD5 8a8a3e17e12d0c3284193cd91a16e5ea
BLAKE2b-256 4973066f48e3e967997bfb01d92c2af0609efb16347657669a6749b80d25f4e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 282fb2c3c4ce410eb86e0c69d5ad95512d3a577c82f53a7f03720c66adb981e9
MD5 608fb3245e600b04842854e048c48c23
BLAKE2b-256 a039f717e7e52866b6d0f23e5b84ffaf231b2621bdb085e28e5e355444f5959f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7b6adaae7655d7f475ce32ab561e728b497e3d242855ff1e2d1fd07ca2c61406
MD5 973c438bb629d40bf480c7020d877c45
BLAKE2b-256 4c695f6f5e41385b29bf7999de1bdaafcc766ef5a13f87d81e0ce710f8f6e115

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29ce1d308fe96d98a1e201ae12bbaf52d894c5f05382fb1d330f41e5d361551d
MD5 0162bea22e50cf6cd368c466c34c8a84
BLAKE2b-256 2a835943b4d0396867e548baf827faa338c50de84e427979d34445a7385fa3a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3967780444f7ee7f4d4c51b4906477a962792b8e5fd2fb665400b25fa014b07f
MD5 538b88bbdeebc508d7d7cb5f69a2d93e
BLAKE2b-256 ccd2c727bbc137ad309f9ff887d7ff709c001e6090b731ac8bf5577ab9206b46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fc84ebda030c5b5a7e1224b8742f357a911cff3b92154ae8b942ea1ae1f8a60b
MD5 fcf5d6d877a9c059bb84ac2d7f51ef4a
BLAKE2b-256 d6e2e0bede20b9aa58020f10a751981fb19fcbf3c6de09e92ae146e1a788ebb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3d91feac4c29d5d9d29c81aaaad30348c9641ad0f24a9514d2f63011ec2701e
MD5 33fb2b539d93d0896974741b0e1409f1
BLAKE2b-256 da791853720e74572880eb7c2eb96708673dacedaae5acce1cc6ac5138416885

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 072f6c83e35c8293d207c45b53d1e02d6730aeb768ba1e2fe157aec9bd697819
MD5 2d6fdcad7f352ed04968a414924cc976
BLAKE2b-256 06eadff9e5a3f0498c4f777b8ece5d64534c431306918dc3cd929b7056b74531

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d9bff4a49ad436a246c44a0ae657ffef681b721e60057c79cfa1708c932bf22f
MD5 2ae3096c577b3669de27087ee38a9bc0
BLAKE2b-256 b2798cebf1e10db4b2ef856f5565f6e285d9f92d1dfc401437f2a5be6a2d27d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4ee5f14c4216d604fbc2d4ffbe8097fc1b19455be131f5bfa4a996e1a0b215c4
MD5 2ae42e1498acd29538895026564c3af3
BLAKE2b-256 fa7d85e61c9ee06bb742bbd3e6e2dbe8e16ae1bc3fe9a571accb07e8d519bd9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 573eebd164ab83f287318ea95b129ac26688854c63fa031ea0b1084c68b7f656
MD5 ac51d80f81d15c6cfb5beff784fb5495
BLAKE2b-256 f18f94295bfb92f3e496878529d4e0963edd8c79ed8c37e57a7c4f0e45c000c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0cba9a9caab87df072b8234b439f4a269c9eaa16e14d5c995243b92ba33c36c5
MD5 87a28e48150ad6613ede1dbf9eb165fb
BLAKE2b-256 bd1344cf274799061209a69949515dece86e5ce90065a37c72bb4e52f8fc418c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 be36d5c4ac9586dbeeb4325943f5e190ee89bd9b869df461abbfca8906e6ad1d
MD5 7de45612666e1fae52cc0d3e65cc31a1
BLAKE2b-256 3b57b34d06aa2e3f75e293e6c614225575e0ad9d5122ca787a45162e8d157ef8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f957e368154fc7be12bc6454928eae4d92df927262181ed60e9736c76456ab8
MD5 14e5280c7a1528ab22746ff4e96065ca
BLAKE2b-256 8429606453b3e3fbaf1d9c81732b5b77f319e575ef0612689af0fe850d6100eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408091721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1c5305cdaf93965c1880a782f8330f7e1bb71f60a06dd368209637caff1e6c11
MD5 ca585fd607e04871e649a2449fa8d40a
BLAKE2b-256 d93c058bea42d569f171e9e1f9e1ec1a6afeab1620ec8fef37c292ba4237c4a2

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