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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bcfd661f606ecd23a25ed01f4493a3223aaf05005b9b8294a1506b8fb2f25c06
MD5 656ff5e765fb0726d365d06104fec33f
BLAKE2b-256 88a0bd5f95f216d60d10b3d9efd52bd6369e52fa3a0cd8a0cd715f4391e58726

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 45295162286332ce58ab90c0cfbcf106e2a7a8395f06bd3d6a33d2052a53eb45
MD5 183e62e42745e2e594760112694b2516
BLAKE2b-256 7d0341e4c029ace1641798b149eddf3b6fc0a4c3bd689729e4c6300567e3282d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a31de38991dde27940ae7dd070e94364e59ee552d139800268f9861ee14fbbfe
MD5 4b5e1b01dfb6f14963e5cd84e3f4c07d
BLAKE2b-256 cf88b80ce28dc08a1454ae2a584daad162707346bad07dd2e7f7c1d0c5701b4b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f81abd60c3d4074cd0b5b3da43acb736224764bc1e2947f720032d751821f9c8
MD5 e2419521e8cbc6c0468e12f2244613fb
BLAKE2b-256 92a1dfb93a9ff131e0aa4f253efe021dea5dbc21f6884385b68cf1f05c1ef788

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 64216b06e62bce6cb32d7a1b3d9be5c16055efe2584538d3060ef442bfae4851
MD5 d516e9158bc2d8be2c873c0e974a7f60
BLAKE2b-256 a8a2ff14381df6f1624a64b21b2587b64e7764f7328e9007a2ed58afb8d55205

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4d3946dc575cbb36add8c67d4fb029c66adabc443557645c8ef5da0ea065e09c
MD5 4f9735d69c83b64f367b71425b837e59
BLAKE2b-256 c09c498b8e0462815bf6e4a7933f287c787d719e2699f1616aee114ffb4e64fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12b4f47621cd05434fd64bc32359d76a42e57fceeca2a275fa83562f3a739a69
MD5 23cf83b5891960aad2c8aeefa1b2f9dc
BLAKE2b-256 0d62cd93c43ab6c2d6b38cb8007848e0fd9d96f799d2601100dcd730691cccb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 187fdc337b66150f8bea0dccbf042bb9d68486374993636c648d46a640d8172b
MD5 3fc57945e3bb52d63c2d42accd903efa
BLAKE2b-256 d68ac9f7cafec8e38a8a771996afd4da1969d7599652a7f9f961673811c90716

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a78a9d20edc514a4777932839e097e8bf4bc8fe86411f0b2adb4642fad5a5029
MD5 0ed1a63f8a67e78298b75a4412bbccde
BLAKE2b-256 2a88aecae28502c94ff830dfb3f2029e5260a90e05c3eb990eb3202a47afb5d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6a1b1908d9f58fa95ad9407246640de6bf6f2b54bf7c29a12741bf5e09146ddc
MD5 a2c859000a6b34690113b9ce2376c9c6
BLAKE2b-256 fd0cc1a1ba85a4165370b84371e2c1480b8c8ca651099eab207584d0be642bd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ed690cc23fc2e6cfa93c5928491ecd3dd9fd703315bc979e779f4c27508fedc1
MD5 c5d7fdff13bb018480d3f51dcbd8dbed
BLAKE2b-256 551510c4e061e0d0a9f27a0f6478e21e100ec2611936c748ddd5b0f623b86054

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6f20be1e3e8d2c73d5b1d95c9285f1eb8886df3dd79ff90f46d65c148ceddd4
MD5 8396af050bbb433771c63e1970c07aa5
BLAKE2b-256 2f5df15d31b178a0e6589b883b556a0057ac93add08629e18d669a44d5b86a2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 889e2f020fc5e3390cbb10352f2a2798ff2a9b546d9c9cfc44ea0f36af85a29c
MD5 fd8ae429a31b2b7326c179ddbef5c186
BLAKE2b-256 69ae83da3585afe786473cbdf335913a8e48c8165e23493c00ed969d260bd1e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6ca57549e0bec41d950d45b0d776d1c37656a2a37e1702166e26c3401d969982
MD5 c77b6f19c03d7b8342440cf784092a41
BLAKE2b-256 8e1e0b197949f4e81bd476d7c6518a11fb984f1b2a98fe8a4647eb2d1298f995

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e6c21c4f6620f5fc94212513131302fd908ed3644a919af3440ce67efc7c9a53
MD5 2b62d35b8c4cff94a10ae1ebd8964f93
BLAKE2b-256 2f1340dac64e17ad4aeae28e7a488fde6f71ebc69923c3243b14f13e0624202b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 dc50175fa0d5608d7e51a8105669942ab02169db68ab4160e4d15519510d8f5a
MD5 dee7c5a505ca8a9fbe5c747d52136727
BLAKE2b-256 0b6dd6bc42089c5de0144c202dc205aa6be9c8bfc6ba6f605917e825ae005291

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 79ffbe8dc835ae28970dd785c9f36154dbce469c3ca3a01f572e437e2f032493
MD5 92682c44b7ce5a71889c21ff80a0d2cf
BLAKE2b-256 c0bd8310a1a2a59d36fee600ebfc233969e6f69c1ad77aef34be712dce63dc6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f95542d09408f0abb018fe4c80bd27a4db98016a50e893585dfb4270cd7a9f28
MD5 ca0ebb836c1c1b0a46098f93b1f98b37
BLAKE2b-256 1749bcdfdc34db129fe6a7c3374b1756df8fe1ff66feaa136dac8d7ba61e52dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20268d23bf4404687d6c303f16b134ec5366d8d911858926dc4c680d1c62a755
MD5 1095b6cd3c89839cb5420ee3bb68535b
BLAKE2b-256 a7f1eab7e7ad2a8bd28db1d895515e25ae06744c4234be47ad1591ff798ea2f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407261721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d7228c06246c5ee21bb520e2fb79c039566e992d1f3f44cf7d631abca946a4a7
MD5 5db40da543c9251e05730e3abab0f89d
BLAKE2b-256 fd444737da6ff00061fe27a9055a19bafce47ee377d0124aeff69ed14e0462ed

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