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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f9520b0aeb9e35c8eb9833b86a7f408d52081b9cb399310c4223eae335db7e9e
MD5 8c2122a43b782b1160b4e1bdd6828e86
BLAKE2b-256 983083e4759a7566d3020ee23c1d09e1521c2ac95908ce4116d0797ec7d24695

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb8f2e084802fcd9c2416a1d56c996bf59d236cd4dc3d6f2ad5edce30534c510
MD5 1028ea0309355a55c3d931261f1273bd
BLAKE2b-256 5b82a74672ce2cea462d373ecb3d495f4d530410595c5d904369e7e1df982c38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 22913fdff20ddc1e2bb6da43d7e9555caf21603bfe428035d781d6bbb65a23b2
MD5 c0aaed6498e035bc82954699306593cf
BLAKE2b-256 e8c4d43eeff6407a6b1f0f55e31604ec173b1f0c67108948e964d59e16bf927a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f733fe02eae9a87d38e0b1e2335dc76031126f647440a0268f90cfc16426c41
MD5 8e5e875f56dddbf88e92ed49e0237433
BLAKE2b-256 fdceeb9fe722e23bd95eb2b47390b74b91103f4490fa4348a4ff58dc9dc334de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a9d1080535cecb4df499d7383d02cbb6004cc1c7c510fbb4ad450c3a89d69aff
MD5 ba34df07f3c2e96b747e4e7af78813e6
BLAKE2b-256 fa60ab76ab264ca098efa4f941b275cda3b42d8e5a100fe2d511b8dd382d35a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2bc11555c1297350aebb4f4d277d9ec9c736ec94a445d9bd113329c122759bbc
MD5 6acc2d27f21e311f7954a4d16c96f373
BLAKE2b-256 a27352dfcf09f8aca1306c59d5c6a64b5e248a32f0eeb1ec133b049f3ce393ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9c1038c3f3e1910d59c7e737b1fc725d4cd9543c40d0564b28d5d20ab7326d7f
MD5 2a6eb820671817d81375d59b4977457a
BLAKE2b-256 591f4128823dee847663c7c0cde135cc5d66107f66cf9ae3fb7b9ab92de7f2e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d1e7ca548b6c08ebf3c583d70746376607a42e7f82a7af6b024f5681e1e14e0e
MD5 8921cf7f272b9ae71bd750d1098c9fe4
BLAKE2b-256 02995375458efc8837df8fb3efd02bca877bc5c3c35fb24f9e80c1679f4a3e91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ac4de35f687c8080359edb43d03e55c0a3a8bb131ede15ea31b6fc8b1738af8
MD5 482540b2257af043a983a0707ef8363e
BLAKE2b-256 f21d403cfeb0c3cddaa4d0dca7aa0f078b58531645d1a49457921e09cb61cec0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 14242cc48f78c220ee0e70b61b5ab4ca0af919e0d1d8ce087f1900a74cc8b001
MD5 80b84ec3485cb1faaf4bc915a14f0e68
BLAKE2b-256 2c964ff22f76d035f97ce4ca74afd909aada28b8f66a84b946aa0192053fb1fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 09842ccd10febfcbf21098378f2fd6906660934845c139a684e1d766c62400b1
MD5 4d1a094f3ef87966254957beb035a379
BLAKE2b-256 420f0437c09f13689e9e39ae4f97349aa8253e2d69aa06d0bee1c7dc33af54b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25b7e0d8282611376e792533e2cba04e6c7ec15e27aa474a0b341d1564c6a554
MD5 4d177ddc45691fd2e08865fd5d4f6161
BLAKE2b-256 b0f47b038a950a87df678b360bf041ad608f9b0ec996c5d551af2e29a66bc271

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a8d962da9afca04d48db4ecf41d92edadf50bf1fde7d44f6a0c472e766ce4dc8
MD5 4bb720cf4dde09190dd39824699868a2
BLAKE2b-256 c475399f18c3c036c906b6209243d6a953b4ae40d7d016cdbb2781cc035b0ee9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 712712f38484605c7930f2894d61faafcdf546031f87e088911f47fb92a01b70
MD5 5962e98017dbe4c7e5391d5261d7a969
BLAKE2b-256 a94d0e6db88f41fd3087ea16da2a54a83edc5a7104c630950cf3d452278c3eb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a345946248378a1a73674919171f88e37e807d3ebb23f15502ea44d03bde750b
MD5 3db82df05b814101195abf77fcaffbaf
BLAKE2b-256 c8539c5b2799f24406c7ddb4798affc5d30970a8cdfbcfeab4f6f8b270ebd3ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 01e8440736d61f57648301b334d473dea2fadcf2d313824453de815f8a045975
MD5 b626e0dba6e95644f996c2153a669f01
BLAKE2b-256 439d350965aba56719ce230a5fb45ff844992ecb70809303a1286afeec2018e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 587884e2a0ddabc0a59986b3859abccbccc3877938ed482ab062e4cb0acd4c5d
MD5 2eace22edae7d9c78b75c9df19855769
BLAKE2b-256 5dc71e965ea70c504af039d978bee6f876da13feed8dac4c8a8e1e2aff4c791f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 462bc6d12880fd87a49d2b96bd046240c0a1fe9785e496dec94fbf40b209e808
MD5 fd3383886f2682c7f850bac0333f075b
BLAKE2b-256 6d924550a15793ea7b78fa8dd9bf365dbc2504267dc794a465194f7d4e6aed77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 65df330527865aa7f710eb7085d568672414baf6023100029734f102b79223d1
MD5 64618ef341888bf34b880ae558e0dedb
BLAKE2b-256 dc8c42787eecd7e20d5f7c480bfc23e01509fbcaeb84012dacd6cf202b9dc70a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408061721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7caf53fb5015836f37daa2a31bd0ccbfab18eb882d02e87807341f6c109901a0
MD5 9378e38c6037c0acbb890760c68cc3c7
BLAKE2b-256 ae3d86b440707fbccb62aae14114521941ab3250b1774b68e22448c53eb48737

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