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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7d6428a37fd3ebb41437807b763ea2fc1fbe9e47435e3c35802922a39f03ba4a
MD5 c323bbf02bdb9d5a766f2f328fde0999
BLAKE2b-256 ece989d7227622719520a757379bb32a8b80fcdbde0b41548fe28dfc4c09b25c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 10d798a28000a4b01fbe180263ada38027331730bdfca6ea405c4a98c9e28aba
MD5 c58ca5afd389d447c529d4494b4ae677
BLAKE2b-256 22f6e69cd3a07828fbcb050243456a30c17d3c2c9cc3d9bd95cbb1596d8e43d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 57a7fffc7c0dc694178e9ae8da8ffa03e3f988fdb093839b34871e26d8bcc1a0
MD5 234777be7c9be688dc602401c82bd3d8
BLAKE2b-256 1ef72e9b83a0841a49ddabeb0f3fcc58ca7594dff05de03908691545fe76ef3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3214ceed2cfd755654953dbcef2fb16ca9ca088ea963cc4207e8c152f31b8247
MD5 6077d71f49081a033ca48e310edfde82
BLAKE2b-256 49526e2a75001a1d55a01a42d067152d3f06b3555f264c729ed25e4bdfaabf53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4819926e697cea69e95bbfc74260329e4ff48527be30c3c8d7677b3f87c454ec
MD5 bdb7344f195a8839f716daf5bcb5779a
BLAKE2b-256 37491a549ba016e05eac716d93bcbe33385daa265e190c5d76de69393c87dd7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 80744426127009950335d05d3676ff0f280370dff2096c4b8500826cf92542f6
MD5 2b674d24d232df6beb5606aab50851ff
BLAKE2b-256 ed94dd4074d32022886e0455a2123f6744f207dfd5d9b95c78a4ab7ca7073325

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ad69cf2d19bf3cae1d2a54e51327bb4d8e991d76e3536f48583381974b651558
MD5 9ea9aceab54451bbadc2f3101da70bff
BLAKE2b-256 47061748a1e6538c77dfd383906ce2d97c240030c4363fcdc96db9af849b2a99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8141124a590a246815800350c0dc735c625fe72bae92e3eaecbb530a19a23b12
MD5 9be195f8ebecfd2122a4683cd29b96de
BLAKE2b-256 b472fadb9c01c59e8eb48953c050a0fcaf5ec576f02f359c30421307fcb73696

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5dba754d562ca29d75a481e7732422236be54ee818a46b9a968f1796c6dd6ab4
MD5 6874139d1d5c0d3f3fb162b9e1ab0dc8
BLAKE2b-256 1d252d9ced0eac1a58a8f0e99d67893eba543d19fc95396bf388bfcdd91059db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b06574d130ea225807cde73ffd11be5ae455e9604f188683147388e088767ad9
MD5 b826677702a11261d3de4ac16785df57
BLAKE2b-256 f63fd0fe5c2d314945cd8abade65f4d56d2e6151e12925cfd8530899f4284825

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 eb2d335d4b5746fb446bcba5069dd3f403212ef9fd9627da7cc4afa72c631681
MD5 9bfb69762f85889a2ff85b8139f7f058
BLAKE2b-256 6a80cc93816af64dbb631fcf041690dacbe909f5af0c1c0348be83dfc0f5b35b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 13f3ccf6c6326004205461533a7444b725154f68094063933f740f55beb5e574
MD5 4611888cea14ce5bac596d776d582f08
BLAKE2b-256 406822dbafeafa7841184ccd914fdda70bd59e343f635fed2fbdded50fbe9a8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 73c09e7a4233882d88180a685b0ada33fc5bb7063b576d06d0f81cafecade6f5
MD5 8f0c02a6468ac375a3d652121530fa64
BLAKE2b-256 5c7048b211e21c578a412727e3108d08c3b19ebf962687238bdb24f460972d35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 179e7fa5e7699e7add0eb9d700d7b8aacbc14ada62fdfcab037c02ce2ca13692
MD5 0b726cf78dafd0bef881473e31537c56
BLAKE2b-256 63ebb9adb9eea7b0e73da206f39120a14d88711d19e8b411d248c4706c56152b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 93f32b23e572202b055e74fc8025e5535a7de596fa63141ed52878409f769b3a
MD5 05941369ac98d4ef07e3625a17ba524a
BLAKE2b-256 45e2db5efc4e30cb0054a609e825c6b161e1845e2bc6a883c76a849c6ea1e921

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 51c859d1479abb3754467a707e48cf18b29c5f6c4bc489e484868a19af0bd672
MD5 5203273122bd04c2e5dcf51aef5af39a
BLAKE2b-256 38205c16009c6f30656a88ad265207d5044f7e1ac36cc96d738584a2f3be1e05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c389953d9d41ae5803480081b9a1675d0aab8c58c81cb22d2c965ee7b3a87c5f
MD5 11d684987887dfebbf3068774bc6c30f
BLAKE2b-256 ba559208d717abc61c460b002a0243c5cace471438d166727d00ff8d391c0452

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b5b3a9f65f5620679ffef27630a78e6368ad21d400763bb5bc16ca80d069397e
MD5 7f4e198a8f19b2e4448707c30cd90577
BLAKE2b-256 3492f3f0e4ac3f7deff3cc69a6fd5d7e98b319451094bf0c8737e9678e74617d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26b36a6b556ee273ecaf64aeba8a5de217365efcdefcdfefdb8fe05548648817
MD5 21b08e8228e3f4c33bfbad63f6d818de
BLAKE2b-256 4d886f128e67e3ec8b18d16c4536f19091e0a1adbcab0fc095cef74ea935b650

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412171731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 88b817a6501305d483fce41dd30f7234b89f8819d5d0d14695aa2e59d8406001
MD5 5e662422211a10d144bc8f65c6bf027f
BLAKE2b-256 ac4a4bb6babf34798184c83777179c4bb390ebac9240c8c3e080ec12b7c736e2

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