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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 58d0116d466758d2c6c43320dc215e807ed3ac1c48fcb82002cff27042a76be9
MD5 a9b5916e254fafa15f4862245ae5c665
BLAKE2b-256 7d9d7c2f57ebfca2a14b6cf5045927395ed59f197304a99bb5d175749ffa595f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e6dcc691516a6cf906ff93fdc1ba321a83a97759d434551e5853d6ec396b344c
MD5 d4a06cfbe217089c6a3c6eae6ec0d7ea
BLAKE2b-256 c0d27703b7bd75bcf2799f0c317a18c9ce3fbc8589195c92f0523e99acaa0229

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f8d3edff3864b64b463f40e9a17c6094a4bc4b7d40ad945119ccce862d0726d6
MD5 66a2709bb4f2358398448831d250427e
BLAKE2b-256 757fa0322e0bbe814c7fe380b48a922a67dda8ec37b4d73655f06226ffc3cef8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 489ec906feb415c27b35d2db619eb44907016c14ae98ba2c5f8e1ad7bcea7ef6
MD5 01b078b8357046b7d6ca0022c35bd6ef
BLAKE2b-256 b70ba38d422d4e70c64500f7cb7c6f96ccfc6a380e78b919b447891aa07f76a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e62ee67bcf36b73ae31aa6f40f94dc4d679be6906391dbce4af3407314df0b13
MD5 751fae3a5a2ef46de37d637f2586e106
BLAKE2b-256 35af6acadb37a2491f52b95bd815a7b2baa5f0e4d686edcef851a6bc9e7b434f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cd34deca4195976d78d752460c3652c21cb51656b62b7a4f1a36424802fe692b
MD5 5d325c453eca75cac578f973e813b564
BLAKE2b-256 739646354ef1d3416b66f6676893ae751ef2a20436eba057084301aed0ecbd85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4369afbcc9ff9e1ec86d637f16dc853b2b3e021c265feeef41d5bbda58d61e1c
MD5 def805e3a956955e5994185b4b469650
BLAKE2b-256 6df7838d74069e8ec0e50f6c7d6f60cbf3e5521a440c0a72ef1d20596a16f2ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c3686909000fb1be883a6f0d6f2d8a04db5759c3da2679373d6d6b622f4df8e6
MD5 a05629c192344760aa10249ceeaa5f0f
BLAKE2b-256 63efdda9d3ae52474a0f557d8d687307b91588295e0b828b88da1d92376fbe09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6761e7d96a3b5453db9d713e8419a9474d569c6ceb84ea41c6bc10aa8605feb2
MD5 0c085eafb0ce06f6b51e9df665df1c14
BLAKE2b-256 853dafa53dac91325ee939c4436089ae6f8fecac45836dd563f8fcacb2fbf781

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 51cc42dbebed4c45d2783fd1497c98bf81ff3e70202b99888c6f4d88eeb0a4d8
MD5 776ebe9b5c774060ac4c360737c778ee
BLAKE2b-256 8436e57f1a35a73b7bc3a4a8fd0c7615f18832c1e42ed078968b8fd39a043782

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ced262678801a7ce522bb540edd7157cc4cd56a01947b90ffe657c758be12e19
MD5 2f8de14ec5f952fc6a7b9337f0c30756
BLAKE2b-256 27ae15a8e90ea17d0c41a031c35683166c5ce2c2960adffbf2a326402381c229

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fbfa87c13c148d3341c19f5e12264d019ad20985b411fcb1fe3d88767b952e35
MD5 932aed3c04b907e1c330dddda1bafc12
BLAKE2b-256 fe246e66016422996f2264aba555dea9cfd6a19ab613732b150aa395eb429b09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 72ccd775f508869255723da33baa21fd60ecfc8e8ac401a6e89fa18941453545
MD5 d382acb4b498101beeb73f5887259ee0
BLAKE2b-256 da7a2f34abde5e00e80f2d3c80c7bdcecd196b49d892aac26fc5bcce5087f5fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ba5c08a01b2ebd67e700324934419e535ea86efeb92fd6237c28192560b7549b
MD5 977716f4db2a1c97c8bf43c2f6f41fc9
BLAKE2b-256 6d9516558ec63973a936919165ac4739ee4f5d78a53ef350cedd505ebb1405c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c08d3948184b951f8d6f0027deca5ac186fe1967dd98c35e4dd5324f4bba5cf2
MD5 01632449d8654208d0fe3a25de8bc1bd
BLAKE2b-256 0086e7e451904c9a555e234af75fbd744b1a127f6b4f40c2840558763b8d4df6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e21623260d7c12404f6d826b5f8d2d9c2025c6c4a6c0f83a452440c113db8350
MD5 9710a0baedab1086dbb834c837178070
BLAKE2b-256 bd30a8c0f7c97420ab784a00b6d16923f3a070bc4ecc9a781fdf628c104e3023

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f52e5fea446120b62bf72265d8fa486c296552b387de5720bd2ee64e45643c1
MD5 5cd749f78056bcdf99a5a6269edde856
BLAKE2b-256 e481e7c3656dac5efa4e9a81c36e2a2ff995385ef60fb02bdeef958b77f67ca4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a09de7ce0aeb32b9a6fc0c343cd5b51619bfc65e30ad47317f19736c5d7fdbc3
MD5 b2762e441fe642e1f573ce5403b964c3
BLAKE2b-256 1fa03056168566d5335815e08e8c57c290bb31a6526b00690f4f650be1c670c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aca7508c799c3194be7644c9044186ce04bffcd7aa71e1c5643d7e9d002efe7a
MD5 b0487ffb483655ecbcd2a86ddac4ffdc
BLAKE2b-256 d9c8cd4fc63e96c940183bc4f92e9f1a516786b96a77d6f01362b2e3ac62b6db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407221721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8e8b61d46a1fbcc2493848b59198f7d411d24104914eb8f0ec0d453d5a6e2573
MD5 97c17afed5138808daaa5b29941080f2
BLAKE2b-256 96d9931c3c40476906c464cea72698e6d12385a47658037a77b590d23e968f58

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