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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f27cb8fbd5805e2e44b001cf4db13be5dab2b717610e430752344aa51b9e23ae
MD5 466953410592f1b9005cf4431244605f
BLAKE2b-256 510f1eb454920d729ce24095fedeff51df7b9619cd9f060989b2db2a6e5ceaac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cbc5dec1040451f71b418c3daa3d0c0ba5e1ae29fa64bbfff13cc9e4b754fc2a
MD5 0ae80fae1198b75988f0e07784eb0187
BLAKE2b-256 82efbeebe19a8bf12d6e8e2801d2b1795ffbe87eb2784d358375c3727e446db8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9e2d4fa096ea71c3886aef9b12116b3ebda189d269f20324955f15d0f63fa1bc
MD5 62a6cc4c22bf3f7a1f8cff8cc39b817b
BLAKE2b-256 468a6e5ad6d964421b248f853607c2583271ce1fe494c408d708547f8622a3f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02f5cc9a8c9882812b7c547f730609f5db00134aad7d036a3ae2ce856d0bccc5
MD5 88b5eede7406b19fcc4d2cd88c9cad96
BLAKE2b-256 89c6a9caef48948a8d81573a7b1d8dbb2e2256f8c082012f456498462bf3d4d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f2a1b8ef901b824f9ca81945c1c877d7c3375c25c19039771a1ed2722a9f3508
MD5 7aeb2d89d154444bded97b0b975848dd
BLAKE2b-256 4eaf3185a77f2017daf0f1920ace6abbca67249484d0ef7a7dba714b824f3754

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b4bdcff6d8a671dfdfad710129994aa9fe13d63a58b3a8dbf7f6d30994af293d
MD5 01c84051751a57587ffceb9fb24bdedb
BLAKE2b-256 f469061c276a6164ef0822dc327b822d342cc9bf1082fee7201e3e73a58976b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4d036c65653b79416ce9b7b8059dff8476fd7a649539dc29bbd98df78e943292
MD5 ed5b14dcad9a4e21283e0898a0606446
BLAKE2b-256 4c6deff615d33c05e48aa8a03cd00c6e82ce45ca2cc56b98ee7be6bd6c27f67a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 422c3de8828f3f5c3541e2d2bb8160e90c06c003222081fc75b6ce61dffda94c
MD5 c9b946f2f0710bd52e80f58c7cde79d9
BLAKE2b-256 8b7c187839fbc3cd56d4e6050ab6075a0237b51427f440b71a007009814401b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b60312f9aa287a0f2f31575afd4693e4a4be77e8fa5a10cc1774f7e91099db42
MD5 fb7b797c88856dcf4eb1c6ad990100e0
BLAKE2b-256 9ba60cfc47c676f9bc1dfeb7fd0e534ee9e1ec73254241414e6e3e8b2c5ccfd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 79390b71e2831568dcba8a4ac861a1189b0266357bea6902e3a18315dc03d6f3
MD5 e68dcfd631e940e4388bdc427ad34917
BLAKE2b-256 dd98d7d42d80216d9b58dc8cf4f4eb086e64723830cd169614a8176dd7c77e80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d76218b52a41afa84733de6d0404f0624ac4142510817fab95290bdfbb9616f6
MD5 e5af9a3bda41cb72e77e275e00ee7bdb
BLAKE2b-256 19fd0f4a0d902a647c2a001e591dd812b6cd9d2134561fce59ecdb4bcb3bdc56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 904b284c4bf76d81b554e99eb7e2a4ed7ebc7ff2766cacf9010a34d5e1eb4c64
MD5 06962453134a0effaf638f161f8cd0bd
BLAKE2b-256 40d75f68f59c6d86ce50ab70f795ad2faac18128df1e291649de9de38b82dacf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 407f03b020968d962856ac16c3c6b2411d0b2988663a11cb5020566667819bab
MD5 5aad783d59d8984f5d690dd369f6b206
BLAKE2b-256 258efb937a6b8f828cffb00c7e6468eadcf500a0e51f9fce9343980ea0f07847

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d63021ea03dff9cdc3db16cd9a06d09db56e48466489ac1eae709f1287766d22
MD5 382f41c3801f308697ff56aee0e4e595
BLAKE2b-256 a1f1c7192aaa0f88c3aa01b6eaff70971eb5ca78546ff81820afc3c9aa39ddeb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1997cfeb1263b74921be98eb11ee5057da8fe18e6649da2de45332825ec30f95
MD5 6d8de156094b07e5120f2e333892f129
BLAKE2b-256 3bc02513f9a06ce11ca461a7451cb2e44e995934dc00b30fae7bbb5376255dd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 58125cfce0b6a4997eda49c8fdcbbb7fb4bb6b936e1bd6021bd1fd4162a6517d
MD5 4000a0983cddd463fe35628333d9ee57
BLAKE2b-256 2d8efea3d2afd8bb3f8e51f61198cb8282e668faa7855bc32cca0c56e855f860

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 caf54094c2512e8475d94dc3d2d955317d10ac2311737d092a90f85346889e7a
MD5 918f3a90fbb24fcad69638fb20ee598f
BLAKE2b-256 940a064a8be21bb901d1fab0190d9aaa77c401749798b06a91f899dbca187138

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ab85fddbc8be9ddb5ec68fcba2af424e8af86b3a4c67690bbb73c701e23065ac
MD5 3486f317bdb96f5aeb8aad588203e890
BLAKE2b-256 9ad601802ee9a6a7f0e3f626f986a6f638fc1c769482c4d75b07acc3aa5ce3c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6197470390342a9df043d57fa1193e4e4a469788dd183e363fb12e1a6a5db288
MD5 0fa64852fd80229bbc93b9a503fb38dd
BLAKE2b-256 26b6b85ed1f34a7e90f5f272fc54c15c2fc255f14cc2f2a2d82859c4d234c597

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501191731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d58af6e43600881dbae631a93d728949929ea80aeb915619eef31a40d0508f63
MD5 ed9d43f646aff3dba8d917017c740992
BLAKE2b-256 6feb164a89cc5ee38d74a255ad243dd24a7956cb9a2fde7fc76694c2af79b5ff

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