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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 065f8ded4cadc86c5be3cd3e12a849c5983f052fb1ba7716e3380a2114363555
MD5 f4f3458ad49b7cdb914dfe00bcb71462
BLAKE2b-256 1dae7672d61034112188abb166554de09d9a6dbb25d255d7ce14580c82217fd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5de75921d776ecf108366313010ac65a72c3ff8f717a8a38ae449fb13a9851b8
MD5 10694eb45ae9f11df4016b443a311eba
BLAKE2b-256 f336b3eac645aa5e94737e632a3db9b3f2a85da34226d86da83789a0c2839706

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 31456d4d22c73da1fc0dbb5e7016e041149026cd3b5667723cbf8f0d25beef2a
MD5 43b5a37e9b76d4f7f0aef4e9f1ba05f1
BLAKE2b-256 ca03982980235cf786e2d726711d8c505b2fb4679606b2cda36500c140306f7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 14677145a37582d4e8efc37ae38f067acd36ba025f492c1cf84eb6a9a6874cbc
MD5 7aca24f53e087c5085240bdf37b65e21
BLAKE2b-256 7afa2d4f0748f0fa94c5fb6c6f18005e4a1858e6b5a4f849145f60a8493e5ba7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3cefeb6cc9747fccba435418de7bbb296104c3fc329de34ebe0c50a5d39622b7
MD5 79989795bb1ed4a77c0100de4a858b82
BLAKE2b-256 a93338767d33881b9d06e88411a8ddeef3e2d4670857ea4aff84839478348cc6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 216fa7ee58f6e67aed730055f552003bf7ccb3c80fc7d62734e3067dc77101c4
MD5 667ec2df8060aaa4da928523f9deb606
BLAKE2b-256 d04cb537f5ee614a6d09508196b6936af0f2ce6f1bcb43265eb53c5471b73110

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1de3fd0cbd87d792c04f94faf5dd1bdffdee33a4109ae23c66aee211a63121b6
MD5 822c9c1152c28670e09c7d7c417830df
BLAKE2b-256 0e2ff22c605cdea746bb245be24e08be6a1c62c31efab5ee90e701e15bcc3f04

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b856426ec0eed047c9481fb1d3198ac5e878299dc44652f0ac14a9baa5759cf8
MD5 b162114930ba5914db5f0a628c3bee71
BLAKE2b-256 d93b9dfa5e7989754f99ffa375f74ab93bd46d1503727c81e91eed85584916a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ee12d4cf4f5dfd0c111e5179d465051f7e443aa305e26ccaeca917f0afa3df9
MD5 48d3a039b5ebb71c6375ef9daeea6278
BLAKE2b-256 a1bbbd001ca1340d3b0b6a04819e4e292d5be051fb1bc83be7d097199a6ea07f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 db4d973293ba742c13854e4d0459217f48938bf2ed48272b4ea8632112f86501
MD5 80de866ff0e3b4fd1d30befad894bbfa
BLAKE2b-256 7a8bd9a88f2e6724302969ff26439f576a6f5d3c511414ff227a62c161c71def

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 48891fe8267130f464a9bab1055a205c35adea966c979034642f351c5b2c7a29
MD5 2f8f666cc5047606e0b282d0a543cc8c
BLAKE2b-256 6ccf44dd942647ff69c2bc99e0f585c36cd3aa0cd0559c0c9cce0b4e7267f6e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 54bf71fc8639a1335c2774841cd56c7f934e46389e573be748b9391bfb9d431f
MD5 f2196b185993436446e74262187ed4db
BLAKE2b-256 bcadc9807088c6fcf1c606bfebf633507547c75bc029ad8f2dceb3ebe3f1f180

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ed1832a52710a9edc9a1d5fc0d097861606c71965298ef07156db757c1017b9a
MD5 014ab7e48a2c117965615d6b7ac226a2
BLAKE2b-256 f74751b9b2a2653098717f0a88eba083201548c30afded01e7abae2b81a8311b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 444b49c4027426624a36a76cd69680f534f2b6184a93bad4c319a25d0d9422d1
MD5 da445082b5f19b96c9c8c6ff5d71b09d
BLAKE2b-256 dfadee4096ae7ff929ca5241f0316c7f1e8c8846f3e3b4c93ec46b01a5bc9302

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 80a57ade99753d8b52d246849700f47949e05578b2f806237cea7231e22b4743
MD5 d54b3cc7eeec2337d63bd5297f77ea49
BLAKE2b-256 5110998e750c1ee07f5539db23ed3261dbe8795eb3f1d031bb4b4b8b2db8e4a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5f60d6b3a4c444d2243ff290d221af93cdbbb291ef7d0506fcf51ff67ffc9a94
MD5 3020d8d7193cb4cd9c6034880146a17d
BLAKE2b-256 d25f812f6912405cf074de032706af261cc51d100c228498f2458db02e1df7b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 501f0106ac15b7cb85b8feb5988359428156ede350da77e99a1d16ad1109ca3f
MD5 1a7f6735925caa0d612288fc00c30b60
BLAKE2b-256 7016c4723c27246203b2a1c3a7c3bc803a9f2c9ebe6ca3311605e02de10f6940

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3da5aee252ab7931118c7c140b2e149d4df37351cb1a8313251a37a7d7fa4c89
MD5 1f4760e8d41146f7d0d663480a279cf3
BLAKE2b-256 fb15c3c72ba37140798160c6c0c177b7dad433a1121fe66e3db142e7126e3e3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87150bbab5fb93df20700bff4c7b090b7ab3355338ecb88fafdced13946c7e1d
MD5 fd104ac95b5e34fd3936533839ef3de8
BLAKE2b-256 0d916fde800f1fd2704f96acc308a25af6b28d06e96b57bc31224b5764b154dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501111731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2664d9f1b540fe14193b766e90c054debf4cf5dad1965b250a10a8b72cdb43f1
MD5 940ca79613fa0f336d1fa411a272445f
BLAKE2b-256 19dbf5adbac86d28e33bd02cf6945bbf700d0ac8a525de88d87f8dcef35e829c

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