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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-macosx_10_13_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10macOS 10.13+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7eed8db39696595ed5c0d8157324e0fe6ed75f88fc11a01dfd4e6ab6eb73e17d
MD5 4a0d79c3ffc2d7441dc091f764f704dc
BLAKE2b-256 5a0298a0c8fd6fff4648929318b2403a3569013ad1fb2fa3e281d5123b9619db

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a758ea446435ab21031a2aacf4d604f409c1b7f28d5ed5304b7840497e04f62
MD5 9907c5e8ab67f6bec97f8285d36e4cae
BLAKE2b-256 8e7d2dbadab7353740c1fa3c666755f36d5e82716638ae8a39c2156326dfaacf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f92e4f4eea31a0d3990bfac72cb04056d1c3136c7869d9fdc1e64fb8fa02c36c
MD5 35bdeaf227218904beaa458e653dc8c9
BLAKE2b-256 d52e36abc1e1bb1ade8d4981b726061b2e545de3f0d867bad89b959702989a2e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e461ff9a429fb62fea994ffe1024ac2debdb9ceb74e8bd398b2f7803e3087be9
MD5 ee86c335d3908f9f22a678a4b6ab16dd
BLAKE2b-256 26564bf93b51662f027cd796f7344c170151480af5daacf95cd495eef234a014

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a2b5b1a91b392a70fcd14f6e30313f528a2d0055ae6f7a1e97ab8408e1e3a9bd
MD5 67f01538ad88749726f3e33e28d9f409
BLAKE2b-256 70f2663b17a1cfd43958211b60a48d98426f539dbcacfd9a6be11e16501fd520

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a1b8882e835127b4b29c1214329a763d4c0ca744b7a1bd2c80789205547b4f13
MD5 791db04fb1191a3d5677a6bacd028454
BLAKE2b-256 8afd8d7eb0bc3c9221de36c2884e6f2a16be3f2b169c3942102d7150dafcf6bf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 38202174b2c8da455ec07fbdfaa4ce82f2f4d6be137e8614ada2c27005ac704f
MD5 cd7659837c4923db058dd77f6e292260
BLAKE2b-256 aceeb6161b5fe313d12d11f91bc0b7bed253248da4118543cd09d3bc72149722

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 68a5ff39c5bafb3225fc6df12c85d154d46aa80168bf49a80a2c5f7745da18b6
MD5 b47a0da7def711181da2cebc5ec90f0d
BLAKE2b-256 0bfc81671c58bab8d13e100b277f18e78dd70ac6a71995f8e0bf14a3471a93aa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a06a98037f3a0058f90369d48015810c295527d3087c7384a97644f876f95ec4
MD5 c88df6ef201068ab7d80e9e0f8610dea
BLAKE2b-256 c0f3269e14f5bd3b778cc516e5d204a07b8905c1375eac1fb650b94f15e6b72a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bb8f0f6b08e131fb6976ac9e950ae38b24eb89d07f8442bf97f545b0d43f76e6
MD5 bc3e9bc6e2b580d4253fce0c485f7f6d
BLAKE2b-256 bc0145c2a69690eeaea3241f200c398f84eb21874e6ab4621869da2565c28aac

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d4b8f2c10fb9f7bc90e5c10cce4c356fd4101a3d20f115852c6ec8ae091205e8
MD5 73ba02474c24d22b52c1c3131d3446e1
BLAKE2b-256 82d1b10284f72bbd3775db1b53d17ec6b5e6b836536491b25a019e224637d8c0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fcda9d3c4795d9215fddced2c363add16184a8c8bab985a84ab7fd45abae0a1f
MD5 87271c4ca71aa168987aa8d2614cd583
BLAKE2b-256 f9296ce4868f36c96152c2e4a9ebcba93efecd79c138a4b41b5e9e5eb77bc5b0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 008a32fc3e0736299382324be2fa58c1b82cc90430c50db33b1ab4ef6cda1ced
MD5 81d90450a8f12b6af4785f82bbc1f40a
BLAKE2b-256 80abf77275b9b45cca369ab418a26176627b3d2f379ff3964b49d76991f86bc6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5654deda319c64518fa6bb6c7f738ef257192a0fb663bf64bb107aeb8893d2c4
MD5 13534cd927d53ea364e6157cab34cb76
BLAKE2b-256 57bdc91ad8f1250b39864f33c7bac4054dfcc0103baf54fd727218564785c023

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d3464ece4e974ce954728495ae681d67c9ac6eb997388740d793dda082920018
MD5 f46c39572df1229407312db1d18efef2
BLAKE2b-256 8f87b0aad1bd4daf2b83d2b13ac3dcb44336c7447db5a697e025b9128f98e7b3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4c6b251d0e74f734d610f80697295c5f417fdd939826b827f847f3cf5276a7ea
MD5 199fa62cfe06838b0100cf4550191693
BLAKE2b-256 7c9be693cbbc49c10d978e78f100b6a3f0ec61816aeac4882e08bf032d5c958e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 614e6165801986a5dfedd16031a7a173f0a6a77c57f01705283d67d621151e59
MD5 ae5ae0471bd5f06b1473ae9a6710910f
BLAKE2b-256 108e9d4f0c696cf948ba3f0f666900b57542c438691b91873fb6b3e59be6614a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 952d3077fb73ae2104a5f320e7d57f32aa2ae48b5cf16f2a008ed362deea162c
MD5 a2b13f1cd8b9202976ad1c836c265154
BLAKE2b-256 9a6ab580bcd84e55e20a78d82ee70c5c77939b3f16a418a50afc205039857cf0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 710f4fa8c31d4510badce44dce7fa2b74edc202e1595b4fcfd72908172b011cb
MD5 894e33fc9d8e8692ab36023649e5a3a1
BLAKE2b-256 773aef52feedba3d6bbcf66b1a407cf1ba074f7f16d0d02bf184e07340779320

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502191739452835-cp310-cp310-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 bd9d0e6545997ecf9d02d3e3394658dcfa2eac0cbdf37fe813f2f633ce4a7d5d
MD5 c03e10a4d877b04da28dc44c398171a9
BLAKE2b-256 f75a7ea46b9eaeb976221dbce51ca6975776c138126861256d66b06fff720fd9

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