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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6d4531e49cb9a8dc33187c4f7a1def7201700baadfa38f15165ed951d5ab6d65
MD5 a534e9bc95e43a49529991098641e14e
BLAKE2b-256 96d76c5e84ba4ffdf0904cc4204f02808d0eabc3ffc61085756c6f237a2caba0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c012e963b2ce337f2f3ffba83d04aace4b86a789d158a59f1a36e68048bf95a
MD5 f9357fa262b65593c652cf06937f51b4
BLAKE2b-256 4304c32fac134240d698f653ceb9cce99d3fea0aebdc0918c7f831b928ebc965

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 daff5c9b509805df99ccea7490a3009c0cd99fbcd5f131ec7b7ebafe33dfa2d9
MD5 09509acfa1f9f9e1f2b9e5b3149a279c
BLAKE2b-256 1a57d227019a2f2d53c40ac73d65d4e5744ffea2a39097523ae4872d7e91d989

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4d7fddb0bb0d12da79e76e7d73eb6f209f19b4236a14899d53e5c813a0c05144
MD5 99469fc472a5ae663c177f611fb603fe
BLAKE2b-256 cd95184e27e6ad4584a80bc8abf5d9209b50ea365faa726548a16280478300c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 250dab96a53995b9c6fa6af0944f22d6068852a2eb459fddfd47219cfe022b9b
MD5 0344932793c4be903e076a923ed90b4e
BLAKE2b-256 2cb5970f7cca7d7c06b9303db685c6bc4a508519241aba2fe695a215de631e99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a58c1fde5281370e0598ab33ab9b03b010314ca1ab6ff99be9f2523f7c524f7e
MD5 1f4dfadd7d78403e594a00956b523b90
BLAKE2b-256 416bdf6b31775846f0f64474df0bfe2864a3a24f7c89b581ff07c1873189ae73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 47629a773768521ec8bc148bfd3c5a0547e54537972a992b7bda094a3968cf43
MD5 59a0c6c1113266acffbd06da157c6ed5
BLAKE2b-256 62fa162e42aa946540ac847144b888bc32a91f7f190ea7f2334298cb9eb8e140

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8a379c7cfc775cb15a5f9d800e9005c68e961ace532256540f1c1f20c18674af
MD5 91028968f2b1b0137cde94671ef98301
BLAKE2b-256 b8430b879dc1dc41c7f704aa0aa4f234159c3613359940c8dc01c09182ab029e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 94337956ebdaa9ffffbe28841d9ac0533e9bdb7f5704c95b56800cd8e80dd0fa
MD5 ca4ea28b8077919678acdaeb6b649a4e
BLAKE2b-256 ecb7e2e67c8147187966d50080f2c7e1a22b5b18b0d14e851f528163ab1c9a1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 45750d1c305805ee1e12ce1c1b856e4b334064a0ab95287eb05c28cc8661b48b
MD5 747b72187af1f351c39d06960f5ad528
BLAKE2b-256 3c131e148872539d815248e25a04ba7e1d7d41eb8b84ff8ca36db8cf1ba86de7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c5c218efcd73bb0fff9cadf3a01f5b60995807a2f0ca1b139896953942e5b9b7
MD5 dd6971f2c718bb86c534db87444afd9a
BLAKE2b-256 b72f48fd1e75294a2dc619bd3c18d336717f5cd84a339dbd27f8d5f50262a735

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 73719bec996c6eb15b76a78a436bc1b34db5729d55fad3fa94caf7cc51f3beeb
MD5 fcb44d253050b0109972fc31d30d5ecd
BLAKE2b-256 bc3b9472995951afe4d0a577bcc647281e153ac310606c39eba548214b773c2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4b50e52f38ee559da2e044a856397bf0e0f5e503f8e02fcafdb158521a7520a6
MD5 99cefa8e840668111354d566b652d6b6
BLAKE2b-256 9bcb7d535199e9c449c28acf6451058b61b3088ccfc59d783f57abf4520f96a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 913002aa9ea68b50c64d761b06c12955b18b9cb315b9ea01b0759aea0945c55f
MD5 7e1e39684ea7942a3f720c65ea7e169a
BLAKE2b-256 cebe873969d0a1bee0cca1465913a210d820c79b93ef8b2068ffb241941d070f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7552f6fb7cdab08239b5b0436485a4182aeec90c51f27637aac6bdcb579216c8
MD5 d4f8076c9308e0133f39fc770b49051e
BLAKE2b-256 0d980c1ab289c6d71e2a9ee9b33236fd8cd2b1fddd7c696a7d1c21cde5cc63b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4453b39a1e0f2c5f0dc52c943d3bd69c9c170ee5517dedb7b4248c2eb777767e
MD5 f66c04356be79a3ca4c9516eb0220cc6
BLAKE2b-256 8c8ca86f52d33244e646534219de30417b61fe7de68eac36857c88c256b10f71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0c41dd15729c6aea49b9a238d3c41073771e6cb14b667d078e4d433647398165
MD5 8c9b677b723bbdc0bbf8ccc63920bd49
BLAKE2b-256 c7a6c84488aed76f36ed7be7237a3e16f26d5801ea558e6e817ecd37fd3b45a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a7bc7c298655e9e31fc8ab21190f25e497d5c99f91d4da553c060bf99612e321
MD5 cc7b8f9ca0b4e78f9bda60fc8ac72d78
BLAKE2b-256 750eb061a640d4d5af213d8fab51db3c6eb402228bba9a9a8830fcbe57bb28d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 431c8db30a6ff2cf4ff11ad4d6ba14047f79d1fa60b45986b611b74f55c9f2da
MD5 fc05e9dafca35e63dee07c383123055b
BLAKE2b-256 4e62f33b5f8f604d69f7be7f0cf0b62c4e928ead59f824b9086d73856fae75ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501231731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a1d34f92c4b8f9da340c9ae851d4e85c3563e3e521895a992bef3c6246992eb3
MD5 5972430ab9e8bcb0444b751d086c61eb
BLAKE2b-256 f2137ad135317b6aaa4ce242021a6a64498fc02b0b34cff88a9ef8f05e84cc7b

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