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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a53b94c2965b8758d7adc40e399eb88f0ae1bda7ede9af7ac58da9f79fc4b6ae
MD5 de499653f51b6d76bebdc4d6c7dceb7f
BLAKE2b-256 6e981241a2fa92786057a991f652c87f2e4a82f39f62e5951627fc0c3b39e4b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a1f91b438ab0592a7e08a88b15b68b86f42d9811cd9af11c7d06812d37e1215c
MD5 4dd9c6006436050ded3b6e2d50f6784b
BLAKE2b-256 e8c99937e763210274c67da1cfbda7e9efadeed039d5b176f629829591d9c572

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7149ca8228b2f117f5c56191fd16c3535e9fde32b29106d3355e369a82f3c078
MD5 89c88880678c1dc188b480112e5af048
BLAKE2b-256 caa6a93811f4ede7226b70cae3e5828d0981838524fc5be8ec3ad5c5f1269337

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ceb8fb0e5342af68c808d8a42b3ecbabe83ebe066cad9c903790b6e73d82075
MD5 662bc040309798ec83287eb9bb1af2f6
BLAKE2b-256 53645bc52a8eeecd21e083ab1428f07c1735b95b474e5347932d36b353f73f2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 86c342100ab79b70d0baf098aa59cc1c48963b10c11ec729b4fb267585f16a30
MD5 456dfb2301397517f984ffcf4cfd9511
BLAKE2b-256 d1b62fb3f61000c9bb0703139490b805f81fce9138280a706aae8ab6c8fe6b8e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c25407b3d9867af9c5e8e0c5ed8503f69a482aa639b4ad07f5cdb613ade2c18a
MD5 854dc0294a36e033014cbea31edc95df
BLAKE2b-256 3deea58b491f6d04aed5e79d48d0d583b3c1512f1a814c68042b623e8f65a114

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eeef6113a02b336ff47a0b6914ba420db180cd35b7ff7d9d0e046b496320c388
MD5 9e4a22212794c30ffdd9eed81f7c7b3f
BLAKE2b-256 b815154302572b31714df94fa94d7dbd79b2d578710427fa6d9edb0957ff7c61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 72fa8faa3b27b5aeac38992bdd735963185a940fe6283eecd72339aaec881128
MD5 08941ece4e537950fa921fe3c5022b40
BLAKE2b-256 77b3c814e8cdb84ccd4479ac42e0fc4300502f5ba3797f1f8326fa99398d2dfc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c8370efecd276e8f1aceb919395c8fd2d887a1b0c75eef2724e10a7a254e628a
MD5 41798a62766719e8afc1f4321d4dcfcb
BLAKE2b-256 efac692b5bb675594b0aa6fdeba8dbb5ec16f38e082a5a021445fb2af43dd44b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c7e9c885c1a34384299067b099f0b5ecd4dc0ca9a1315428ccf9f3e941a3766c
MD5 c1729dffb64492d54deadaa04533ce27
BLAKE2b-256 1627cdf9d2001db94b544a950d8d8e6085d60f214d8c1734220d9860ddd70f6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 856f8ec739637de4c94622def4418765d0bc7a665dbeeb44520f863fa8f9518c
MD5 d6ec2b2a32623c8248d6f740ff4a662e
BLAKE2b-256 19ff6a7749071c4c9a50e1a1b8c3bbce7eceeeb92aeabbfd9d6c3fe598168de5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eb7c6b98dba7331860b0c4c0e4840b4fd6172dc9de575f4f7f84df0462b3e896
MD5 8c333bd34a377d20e2ab184d1c7655c8
BLAKE2b-256 4e4cda5390d137ac7fa0234549be202570d2ef55b37141a3977d17eab9ec65a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 64cfe89d7ba7c3b569f26349e6f29a3b17b365e2b73acd6e839e1ae00fc1645a
MD5 8674b59e86e594e985c067758911c733
BLAKE2b-256 c590060787c03147e96f90efc5398464c71b96fb224a67d692942d75761f7acb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ac0353c23b63a5aa603ab19a224231c16bb6181e053295f944e839d5aadca180
MD5 e0ac91ae6129041125128f2d72a3f737
BLAKE2b-256 a15355d83c98d4b8c17a909a2bc6d4b23924c6a5f0d578d4efd3a69d701260f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 407c09a2af59c67d85609102e17e0259e6ef4537edee4ff04cb97ad4e056ab89
MD5 15b34f193e27b7a70559e4bcd5431330
BLAKE2b-256 2c404067682589f4091c884b3ddd4c6856401eafb5bed219b48977465683016f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d20724905a4ff8c30e51dccb4cfe43e624c6b10fd975e68ccbcc74c03118577f
MD5 92a812994e225964e836622324807cdc
BLAKE2b-256 0b380e06964317d4f475c1fc1567c550f8b0ff8efed2e496d10c0f9068249198

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1010736d59b51ca70d6dd342a381bb4597694cc940701e46b8617686c6193642
MD5 26d730e6d042a6a32c51e29e73f4ec11
BLAKE2b-256 a2846a9ba51102d099c13ca06eb0aaf35cd9f03dac81b93a2d0ca3e88172d4d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2048e1883d82521ce845365e9c98010423f423bf5d47812f2441e88c571a4a77
MD5 7f0064dc547c69390112bceeb5fe8afb
BLAKE2b-256 c895875c3830d05fd7c80d7583e52a03313bfe940429d89cb4eccd9196ab8497

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8e00365230dadf72ad0a3c8fd10bbe9dc077e4050b20f9ddf5db0f64eb03e52
MD5 f846456c5eabb5f9bb26c97f3120c0ca
BLAKE2b-256 cfce31f837e03ce1b5f347fb402afd05f0f14378689f5ab84a04b54ecee7267d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501121731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2b6831086d281eb0a546424606022c14be85ea2a4530e6b55b75ecf76a2985e6
MD5 1fdb1b521396a16b91ce05067ce6586b
BLAKE2b-256 450448e4f682e31ba70121d794bb8c1b4701f319fa33a6b7d5942b62663c1074

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