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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1f6ebdb799a0a7ccfeb7b2f8b27c8fcdd2cb2d3423ddc3deacb09af55b4d2368
MD5 8a204bbdc434569613a3b2129b4a16e4
BLAKE2b-256 31b1a186873ff2f36f8f16a61b9e6e76db8700582ae9fd6102aee26e017d2c0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d3426f892be60834a71e2634efe6d355bce9f6b46f512366ebe265db9cd35e2
MD5 2bc8807f694281ff1b0e0ea511ac56a0
BLAKE2b-256 f209eb8e1beb2a6cb9c3ac3d4b0102ea2047732fbd8d7ae7a2f8d26c1cf9f447

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 07eaff92cd3e1368ab7448a4aa79cfe1c1d54981f31247300cd7cb340110691b
MD5 116b1eeadce4baf533f82a9a5f16288c
BLAKE2b-256 3aba82da6d0082424e7875de4a57cd010c2639715f2e53765251e358f8d988d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 300096b952e3f572e151f4ed1f6d6d42ac51b9ed602a231f1f62fb8d4cc01ffb
MD5 ed12e2e5d33dcf2084a99f0b099f77cf
BLAKE2b-256 d67775903aff0a33608e531022368ce5deeb533132b8610a8f481d6cd1b0b740

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 937bb6bd6e0ca0bf4776870c2bde96e5fd2d152b4f89affb396a8ba68bba34bc
MD5 4956afa09c37c7c19a14e3cf9247e11e
BLAKE2b-256 43a737a1521a1f0322599abc86999d70371fdb774716fa779fdba1b97cc2a95d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6f493a110bf1a949e822ad5dbbd3ef2dac094bc19a43463e15dbd855c26ceb52
MD5 80fbab4ad1c6b469236bd28c0541c6b7
BLAKE2b-256 fd84f5f0db01899f19cf412034579862054267c489cafb1a6d47c2061cbd2523

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82c5fd92772d15f89b15291bbf9ba30cf13c3ae84ea9cd63de490e6c5282758a
MD5 fd4576a90a22b94b9fdd0ca9d8b3b328
BLAKE2b-256 606916f7d8cfb615fce9d0810f4de88e4093766b0e7bd9fc50aef1509359193a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 735c96b5a9c3e8266910bcf4c4df1e5d04bf12425c722c146e71e3d98f78646d
MD5 869d0ec77c25b86ac5aa5e9f168a4fa4
BLAKE2b-256 8786c76c4a0f83ee9cf1f7a4599f8cd9bbb4481de902297007f15e59b4f83818

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 690f5ef25c1c839909ec008b261abfe0a6f550eaae30cda3d777d5b7f3a5b5d5
MD5 23d025dc4186f3629d3115ec11cff366
BLAKE2b-256 f0759fb5ef7da797f7b134f2bc10cf2c0eebd717a763375610f0a92c41a599e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 39ee4f9f0e3f64a0f6b3863f3b2532ed6667089d7628322d8128655529211a4c
MD5 86cdd4d163987d1f4a4f5e8af62aea98
BLAKE2b-256 c68cfb3ac2422844d0573acea9a56931af16f3c6385eedb1cd3f7b944e27e9c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 81103b52e70fb253eea03be5c3d9894817aa5f172b1a92e53d66da993e213596
MD5 a922274b8f832d83797e826a38e353cc
BLAKE2b-256 2d308268e8b8685fd4522b717d80acad96c65bebb3b14b9931f7660ac3acb3c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 abf0b592f42229a77bc1c97e83e05ef0232618c9fac09155b333341918f90d36
MD5 4a58514f5fb51c8f58a8c1508978d4e4
BLAKE2b-256 702171cec31f7d8c6fc8c04b91d3dbf872d3c09f3e0f382f21388ee8ba7e9a3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c766fe4271641bc867fe1814116198a8eb9ff4263c130d6efe84b8ffb5ab9ca5
MD5 d98ba0dcb791a0dc7d5357a9c520538b
BLAKE2b-256 c8e90759fb89ea07d4b7ad034db0836277e170a219b5ad78f268287c443f7c26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6edf9ad03030c01b092f201f52d387cfc9521464b36275fb83cd3bb7842e3912
MD5 6ba664f17a5f07fdcc37109900d2a07b
BLAKE2b-256 d40bdcd35e30abb4a8242a1fdd40c8d1f973b0b0f876f28217b50ec61bc4d8c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 abfcfdd600108e69857add03877384b658ec20c0f9746bfb4fa13ad35083fead
MD5 4c75d5b05ccb37408f28bd9a4c4ba8d4
BLAKE2b-256 679b449ed9040ca54d6d53047ea516bbf4dd5ba415cdd56b7ce98b6f94396ddc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dc57c9b0edd726fe35cd2e083ddd659e686cd9746efadd9b9663cce3ccd86e85
MD5 8953589e095b8a49dc8cc9a18b60d2c4
BLAKE2b-256 9d03448e8166ce35567dc1eaa24361077c9ff1fb86d1642bd3c89c75441d7dcf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d903c11ef01ab920ee62fda1633f01ee606d1079e257fcae771b7248c64a502e
MD5 68134593687f499873bd1445c0c467a9
BLAKE2b-256 34ec7d890b8a01805344975665457e8d7c2cc6f723921f9d22cd091f729935f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a1231906911ca3c6e2e2accbe8f7388f385c55e25f0dffed8a80dc829b2143c9
MD5 2d9ed46093b4c4c5dedcaef020276c07
BLAKE2b-256 730d72052f3a1ae99aeb0773c5ddaa80441b3e04251ada1e014bda4ac28553e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f85723537852af95c0a46168b23a73005e007c855464365c13dc346a5ae3ef78
MD5 44dde5c913d923f8bc56c36d5879abd1
BLAKE2b-256 e7b42ba903d816545f8dd56cb70a97b81b9452822f34963fa0e82d1a32b90b9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411261731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b5b4892a50e6cf8026f8bb05fd1af299c47427e4f005c7eebf8cf9c2ae8dea88
MD5 efd20ec4a0d6f9d17dd67102121085f2
BLAKE2b-256 a8da280d48f37e3178aed7ab3c5b4ac31e85717d5531626a3759d02d0c0a6740

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