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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6a12ecdc13358280ff7db22158459eb6e4bb20dfc085e7544497fef0ace4b802
MD5 7d54cbd1532af595b07180c3c88c09d5
BLAKE2b-256 6ab0ce0315cd4c9a9899056b73e5189bd217c352060f46939707e3da012ea596

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d8d9c689fbaa66d555b9e19f3b7c5bab29a3898daf4887df702aeab352c8bd3f
MD5 c5ba641408f7b77151bce6ed6a82f3b3
BLAKE2b-256 cfea15e9b8a5fc2cf7f3f2e088262e14ab631578c15bf04af315c71fabd5b8b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8759fca7ed5b86d92314f8efc9971c549f100799243de4a9756be603821e0c78
MD5 6b264cb7b48903c93f3c9724c5f30628
BLAKE2b-256 148fe9873727080f2d315513166419773db57f64c3c9a6e35af68d7ca8a58a26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ebbb9982a030c25bffa23434421ad2a97e0b4612e08fab8a1e4c8a91d1f0431
MD5 1153290cc2d785e6677bd1b5f1ebec64
BLAKE2b-256 4f5c5acea5fcaf9e521c788e30e5e614fc2acf369698f80d9c5956f4476a2a8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a586cad47fd3b8c15b46f8be11ee349763055154be7319f5527858e966194749
MD5 18f42e8e0eb3e131c7e36f254a22a9c9
BLAKE2b-256 1401277fcba901a78f0925dea6adeb6a384acded6c53f5781675b15b2d3f7b2c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1304bc92d973809f7ceaedf9141d6b35569a9d0f929fc5af80c9a0820ff7eec2
MD5 1fa60114122fb0c1d747cc6a8a88f704
BLAKE2b-256 8eb09ce9be143708298ac5a879dbb45cade8281f86b5f833efbb8173257e843c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5cb25f51fa9a6f8cfcbb357dc9c779a669b98fb56cb7591d2fefb2241c7e1eb
MD5 56ad33dd3c3ec9f9857c9520060dd678
BLAKE2b-256 aa5f5268037c8baa0677f1865ee9bf9a5dbd6b0781cfae53b16a072bcfa94c51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 285e15dfee9d773b67415c74f814cfa634ab0b4a9c05667962b54360970cc126
MD5 68c17074b696ee9c5492d5eebebaa5a3
BLAKE2b-256 040ed56578cf619c6af08210210933adff1e446ab47e5863d0e979374882c998

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ac10f5d01a295f5787020a61e7460a8564f724faeb4b87e995205d46e9af9262
MD5 0e7e65b32ba88424574824c713e40147
BLAKE2b-256 7ce24661e45b21722926dd7a7126182fa77e92f2fbe30f4769429d7591a8dae1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 001469a8a1128b8a870a3a550e393e2e90d2433b88ade42efd2be7b42e0d13e4
MD5 9f7805bfe8d3183eb3339062e81807a3
BLAKE2b-256 f420852e5704a929830715871b2aea91bcae4772ee96a505195d85a57a848a05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c91d4a0af117bd5fdb2fe8bd2080a722ae5be9a97b0ce1b4530450088901259a
MD5 70fce5e64fe64b5a85153d8a0fee0a08
BLAKE2b-256 65a7246278024dbafb544aaa6696f90be9de2f871b74d7c2d0b2cef26023965f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1593d3acfa0aee515a366a476b8e0f26e94777b68b2719a92b2fcf07c1ed4fd6
MD5 6bd790540f55231f3745ef4bfc49c4de
BLAKE2b-256 f5a8bdc483aa4430b4e171f3f8cb1ae4f8e40717e0b1eb21835441edf31968de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 488eef04c59cd7cf5d1d289c4764d164b5f31074351b3a7b77c0292b730ecbf7
MD5 ebf821807b2fb1acee23abc602cbb8cf
BLAKE2b-256 06a07dd7b4cb1ff58308b88014380fb1dd9ed4fd1e3c4bdf77c64f41f22b48fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0dab8fd0faaa786b66f0772f911944283101dadb5a78eb2124fe418e4af25e96
MD5 611db86668b61951ce96bf12a44ccee9
BLAKE2b-256 e5a6615735d0113d88c307d76ca127132fec82785525c57634c7f563f999f7fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 696038c714871830287cf50ce392d49b4da84e11079e92000ab2c8110fdb1bf2
MD5 d4ede3205e7fcecc5e84f8d4786a19dd
BLAKE2b-256 ffe0197413934fd80d0fd5f04410e82ce398f1b14282849f4b8dcc93feb139a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c6a630da2b50c5d55f6f1ba8ac309730f094567a5fc7fbba9c1a24cd42c6f224
MD5 3ef7ef7cdd8af946f103b5e3c1eb0e21
BLAKE2b-256 cab6b9a374d7afc23d22fb2308b7d9ae1bde293796972c8de02720475550082b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4f5a6a95af4290b431a044bcf77577d726b1a8eb19f251bc66ec1786b8f6a7bc
MD5 4dd3be95e05cfa93d73c400e20835c1e
BLAKE2b-256 fa80d1a8575103fb536dad2e5c48d809fe7693ae67a19ee0739e4bf12f825bc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1dd0fb73083014bf96b2b2c2b46eab4d795fb764dd8503937810081fefe2c33f
MD5 5eef661c8d3122910af2a32b80938a1f
BLAKE2b-256 b440ef89722d8b37166f4d93643f8e766bcadfd8c5793dbc410adcadf227bd89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6a0caf12cdcf8c1466889696c32430cd13e72216f9030dec34e2f9aac4e7529a
MD5 f6942ed00b5282bd306958c64877aff1
BLAKE2b-256 9cc821e14624c05b58724f5458969d7cb614bc0b9093c7fc4b720dddb300e286

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501151731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 13c795976c7e0d7b181a7bed3f501d26e685fe40c9a9cee801ea67f36ec12f5b
MD5 97590eeb03525a06114942c992619fb7
BLAKE2b-256 c9bc94c7e5b32a852ecf03d15916bdbdb27f96af1c969ebd8aa124dc248fa7ee

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