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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a11b94899fbd453fd61f66c3fca4bb4dbe57b45f3daa4655071710d5868b08ee
MD5 68335b17b5dcee8972141d9c65c665c1
BLAKE2b-256 cbfbe19dd47d7ae5d022d334700da4022b074866321abc7cb7da3555221df4f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a95670e188266fb9cc94494b83cec29e79150009f8696fad345db9605fdc8d13
MD5 4cb8ad5462493c740637e9ac9bc211a2
BLAKE2b-256 26d4516579e147607df5a25e1e43ebdce1233d7a0054b2d6881a4909c18e6af3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2f7fa7edc73cd9663030fca664c572d48c8eaa32cd6b126c6b04ee9c6286ae93
MD5 1f3d510f5d1d13619058ca75972ed3fd
BLAKE2b-256 0a1e56ca8200a30b0db978d7a6fa347abaa94f274ee8a882b7d5ada0bcdf7f37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1beecbfc079af61ed79cd8daa35ffda15580fdc1f24b0963d4a0b002c5dd7f4e
MD5 233952ff2e80d0d200d66f3d02087391
BLAKE2b-256 b8fc36278c8f6412ac243a8b6e3540ccda725ee24dedea600417a0e331b516fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 ed809ada9e8a35d1a56fcaa840a7ebd86457dd284803ae98393a0535be6d25e9
MD5 d8f6de278cca77197dde8effb0ac90e3
BLAKE2b-256 bb3df6c73b1fd31692a93f6f7d47e05d43cb2c1e9a03442fac94244cb21731ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b18569bd6b65c5daa29b1c2f3f3b6a99261420b363ccab3caab011ecf1c99534
MD5 8e4685596ff57e5c43c4f8e3a4d0ecea
BLAKE2b-256 056b18c9b7885a2e44d2b8eae7a5a0200c6c562cbf5197ff14628ec8b5b03fde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea4ebb4c4af8abd36d22fd12e88d035b0e9991a925f64cec82e3e8bab0a32541
MD5 1e20e98053903cb5e16a018aca3cc150
BLAKE2b-256 7a5d505fde1c37f061ef7c7f6db69a47dd1ff12d5abb147f36b6231ba8373959

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5f57e5406ab20b6d98578c7551932f4b441ece7e16a8cc9b3c6ff66a49a9d156
MD5 3ccc011b6a2847e61aa4ac7e4fe04da4
BLAKE2b-256 d2090d4c04ddfa9bc5cbc6a861a7239e0b9e195d3fc76e27bc0da9186ced2a7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29592478f46324431d3e21abe61e5fc018f827dfa0d65fe22574e032444202c1
MD5 8334bab472d067a3437825c0c33b755c
BLAKE2b-256 77c965510d41cf5b24e5729cfb08aff5128fd0304e8c316d4ebf1babca4877c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1b1083b63c7fd7a30bcf905169c7820a697ee90837c6ddc4777d14cd0566a759
MD5 b025c06d7839db07df3c585bdeaf0434
BLAKE2b-256 5c8b04b4dda9d952b2d295655fdf7013dfbb10f615b350b2007e8d7ab1cf3408

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 005ce3a26b748d2113d004c7f435a7554de04124bac8c4dd9979b72767c6447f
MD5 d99518eb1d334dd1a7188a6080084a80
BLAKE2b-256 6980cb3d79d4f9436e9645621b5b98c9e736fe0adb5f23c3766eb0aa92a14819

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 422c83e2de3fd72dbe1deb79d0766a45faf08a3a502caa2d2db2862cd4536de0
MD5 c43c0e6742dae68c1b602966c8a0a053
BLAKE2b-256 c37c1a56917ace2eded3cfe9e1c056b22390111a8ad6ab6a8c8060519c489b17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a3cb057420e34988ce6b8c59be2f67205bf056c0ee685bc9af5877abed102041
MD5 138c02fb447db0e45674f20849ffaa4e
BLAKE2b-256 5be27bea8171abc0a0f2e22bf8d880c2d0013d59ec9bd0b3597162d0f6fddbfc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db14d1ca714ca68248e9f0e63ebe621076a234b38d1e379399eb78e79fdd9884
MD5 e4dfccdc70719244fb601e90c131265e
BLAKE2b-256 770121a273c72949049692ac273eb514636bfb0bd87978d5ed094a2f1aa39b8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6890e7a99f92048f24c2b276606df1fc260f26c91d5f159e4a601bac303f369d
MD5 028f62604ad2b691055f08fb91e92aa5
BLAKE2b-256 752c86ade80c9198808e620fc6f593ac4c6b040d72301f75bcbeb2a9d815c0a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3da6eeb29ba53e31102fb374b71fc9f8d118299ab267df445de2709fc819b682
MD5 58289c0197e60d75a7f482abde85de90
BLAKE2b-256 9e24a117e5991bf16941d241228ec0d634ea19bdee96f5fac5238765ff46c334

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5fd2679ee3d2daa1d143a2244abefbbb64334f2c623653099f5ec9d111888f5b
MD5 b3ec21a93aa02fa4f505df9d25e32bd3
BLAKE2b-256 a14da22d2084cec734f4adabfe67bf3384a618c9f56e2c5205b82f0926f8c356

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5ef38150e24ad1e9766ec13d553ee227897461bc7ad1491ef25ad7a0bf4bf424
MD5 bd308a94a3a24d54aabee868368a3726
BLAKE2b-256 f854ba3c7893eb235bcb08aa8d092bd93109a43cf0eaf82cadea1237bc9b0924

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8e2272fa7fe10f614549ddf3b0297d630da3d06c2e6f516867579911573d639
MD5 1565f4bb252d7f9ba19a57d8214d9c6b
BLAKE2b-256 46b4bef9433bd1f817ea60a4c7e3a4b94f010bd160d5c09bb984a655a10ecb16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501221731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e3d86424f10159c6b6b537d3e21df501ae77b8f2b3453bb6ebe9900c7d0cb490
MD5 8f07bd0a289b6da43e60bf4d68087b77
BLAKE2b-256 c8e9d7dc9ddd7881f5190c7ca39a1ee6c6aec4af490e4b7b2aa4f378a2f80ba2

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