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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7c5dd20fe9add1d3e2db28adde4f8dd469e15fe630ac5289aff5ab3ea3f263d8
MD5 a1460bb09f733ee845b027893f4cb240
BLAKE2b-256 ca9dc10bf72b31ca83c9647d6406e37d72295bc9aa8dee45235f517b07373757

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cc2ee9ec8333ca10f08f1d756bc41aa1b4cb28434383caf5030414b3e687120b
MD5 0bfa6bac8fa78f724809a302180a105d
BLAKE2b-256 d9499e8c459d72b0a6a3bda57e7eb87be83de08371870313e119c682590e2f61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 addf8bed2b68eddc8f6a2d069d3e2659bf67832fdbb2f9286e1d1822b86038f9
MD5 9049252f79ee4fb99f0dd7966126cabe
BLAKE2b-256 112f838bb531c5a7c9e703504f29a3df15edd7cf58b0c1163b707a8855e4870e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8c61c028317c518f3decf2f002c7609ff31214da3d744a2d0aaff021419fac61
MD5 978c7761ccc74b941860273011e93e92
BLAKE2b-256 511623c502d6842586724ea0a49a63fdf1b2cbbe4d9106df9145b4aa31b62a99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3b327d016a52b82106a1c4c653baf186fdd7e6e6ebae7ad9a42950049ba0e9be
MD5 999995193823bb48823ca38c24649ae8
BLAKE2b-256 c088011a305460d7e47a05598beca6b7efb065017382933a63df7251b6e4ccfc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0baa8d9fa5b98767531598dfee58ed385779264d0728f1c2f529621aae4befc4
MD5 31dcadfa89afb1a41e213c28280a96cf
BLAKE2b-256 fd7468936d1042d8b8b5ef762972378260b03eac1f5cf90a1d7f5aa4f212f8c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 13b485dd50f0d7b7fc9a807b83ce9f380d209fa1eba2d55e884dbc530de09854
MD5 cc71fa357bf92fab0bd97a293d86a5cc
BLAKE2b-256 c534408203e87f51027c11fa4c0b3dcf21ecf13bdf1888fdca5dbea36e0b609b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d10f7b7433df853540f26cf25bc19614ecbf8d37310aebbd12d2cd91bdaacb1d
MD5 532574f70f49a31f23f47a6df6059a6f
BLAKE2b-256 87336cf29c02156b6da8f1c3b52457c2abb5d2aa01dec58e741cc355fd4d55a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2adfc09b3c504708c90a8f311237c3a0016afef9ba2fb9a848e12485f69ce1a
MD5 47d0f7fe8c3a51908cfe6bf0e9f48526
BLAKE2b-256 60c5c9b1de2dd74e9492955e67e3b5488a7ee4c2ead0ad4d6f808edf26d6db64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dd43715b455937def44b6acbbc99f85220124547549396cdbe1b01db1cbb9b93
MD5 71e044fa027d2752022a03c5a48f82ee
BLAKE2b-256 b113052f976fd95baf6074dc3f68f1d744f4d99931fa3f0d17dda07d48a69559

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 362aff0daa8966f4f0a1e01175df749fe39cfa5b873e8a546dd2bb8d49570b6a
MD5 cc80c94e9e1056016552d9d3ba6a9ff0
BLAKE2b-256 dbf8b02fcb5cab1bc205349f7cdb2e3b3c1b51f00326610361dc415216aba15c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d98f1e7f364b1f72991ff46609284c11a1e635b0fb3dafc0a57f6797b4d980cd
MD5 aea96f645e5a86113f72a922c17daad2
BLAKE2b-256 ffdfa6ec1550c12620571af368b16eed90ecd5657513cc7bdef6e042f2cab9eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4785da348ff91d708dc9e03733e800f8c98f3ba7219f484c0ed4e94e817fb381
MD5 dda8876157f33612d0c4519a5cf1b487
BLAKE2b-256 fd61aa410cbcd569a271f4aa70946d28f2e501495640fcaabc2ab451a5c03f07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a6aa99a0d63304632f956a413cf671f3a490867a6a0418559139daeac120c2ee
MD5 3461791bfc9219f5853be08f8f209a96
BLAKE2b-256 1b5c411ebb5fb75ef488c46474308dcb157206a3b3b19a997f0e2ea3a95e2be7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3fe405928ae70013772e6ce0a8335170686d7f188d12b86bef0a8988147074b0
MD5 51ea4aa55ae53deb1dfbae74a36d44f4
BLAKE2b-256 7303c4e4ab0d1e5e16adc3913ed22b61b15002de94e4f4958d4d54db55917160

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c84694fa04785e32c60098eb2c503adc9fccea9b7665b4c280767760603155f4
MD5 0e505a6f2980a56d4902ad7a024d93db
BLAKE2b-256 ab4063c063b06703911411e74101ed0a3fa0e078b78e13974f3fde1273186cf5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 33b6481379a00eaaf9794f016a3317b028c36a527041df2b8de205fee5afe0a5
MD5 d3716a1cc554496201ab3afc6f410a98
BLAKE2b-256 d54ad3b336e8b4b91e535d7ad8b1c50abc670103dfa651b7d04cdc3821aecb8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 feb57ca3b08aa2e312be84a1ad484f8c556e23ab50699ee9d75ca85af9956f6e
MD5 af249549c8d6ac761e4ffdc9c9a9747f
BLAKE2b-256 07960294930fcbf1ace603d7264c97fc214397639302f9b420520528e4ef4b1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1768e9632311ab93a7b7e0139a2bd129757bfadc15febb265d2d8b8b20059fa6
MD5 0f4fb9af7b58a77230f23f0d39f522f8
BLAKE2b-256 d290721a3621044e53640e10700fec4eaaff9e1a8947b8c354142ab72be7991a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412201731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 952b6693b5ff7bb4d7b3aa5702df6b9ffc007f91955dbb0ddb563619e7c46638
MD5 4745bda5199d83a3bbd970538f5cc1f8
BLAKE2b-256 6b6285694525d45024670cf22a2e10cab89c26acfda64d629b310aa4afd275a7

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