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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0e9909721dd8c10cb3247afc1d5709004462e78e45d7f280368c411118f58228
MD5 280bf5bfb289cfa6d64a4eec746f2e4a
BLAKE2b-256 28641d8191d42e82c5a9cffe0a3f6aae5faff436232c6104710ff26fc476d665

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 22f7a5e1b09f96bf3fcc9b7c1ddeb3a211ab06966b9c19a6deca729b62b0ed10
MD5 43a9ae1d4d0dd13c0e9a65831f9f948d
BLAKE2b-256 35225d44c2d616e6e920e36d0dbe8131b54ce8786c9843fd5eb21691f6800734

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6c63da15c60cd509774b6260cd461dbaa5d85a8b3cc0ed8d9b80141ec16f4ae4
MD5 95a8e7d2998dab49745c6519c89d7fa9
BLAKE2b-256 331175247be329246f500f7300e49ab063ac1fce1ec62b59ccc02749e0e76aed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0e0c909b333d4c272374821f9fb126b74e44ddf17d48fc571a0e0f589f0dc1a6
MD5 2c97545cd40108b91c79a2ba41dc5221
BLAKE2b-256 bf6430332bb0cd27f75270542844d198a6e8f53104d3957ff607b33e212dcd36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 956fe1afed3c83f1c104862b0234fb9daad26c9237072092ce7219ea02c0889d
MD5 8cd42f872f587373507fd42482b9e0b6
BLAKE2b-256 a2b5a5a09769f1ccd33bddd2c1fd555b70f5a2d1802f2a4b50920bed75fd2d1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 37fb105a09616389092cf4f466f90a66bd635294a08f5f6fa15d8da8a9289e40
MD5 08bd0e1578aa7d6be371c94733d16fb9
BLAKE2b-256 bf955e66c2bc4fe641aa5bfdf8e3ad97398ea24c17d8740650490cdb10626ea7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 50cf9bc518b8d1bf97983978601a156d75354d3ad25519ec11a9b86220e1b0c0
MD5 12dd16825360032c12ac01a1c6303b69
BLAKE2b-256 7f444a16660d704edf1c515b34c19565d57ecef3b38faf5311cc1af12ccf49ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3f9f65b9b3fe5421c8cb193ec92b9449604110edda308fbe0c4b3d89a269591e
MD5 181c5843232f06e71057b177711f7487
BLAKE2b-256 f1bc7758437704587daed42f08d7d8fda5ef8dff405ff71796dfe33eff417903

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d4d4dbacc5a5ac47459831e7ffc2c3ee5573d21bc2ad634a817d62a25f733108
MD5 6c2ed7012997fdd45896e53c8ac651c4
BLAKE2b-256 d42497174767ac98b1e0757c7d6aa15a8c387e035fe3df4e8bdea9f80dde4df9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c5a415d1966fc659cece06c64e9217edb529768c07de0c829c13f236bb558a8d
MD5 79572b5fd2d2a874d8cef601f1357781
BLAKE2b-256 70aa0bacbca5a5b696b79fa8a1b9f53e7e3910dcf830e5191f3a25604926dbee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 efa506d012ff13221f3e5283a0249e0d3004f2f06726b69ab84739f9ac8ad676
MD5 69ddacd086627a90def9b490a4b4d46c
BLAKE2b-256 945d694ece6d304c97bad64fd42736fe27a41660c07e288052ce2e1929b27a0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b8283424fd97c8cfd7c4e26f6f76875061945a4a1b28f27b77f4e1595ab0540f
MD5 ba9ec8589de22ae23f442a63d13a7a9c
BLAKE2b-256 4b7d5b7c101dd67f62752f23e0bddeb9031fd1463a6fed314fcd56be8ccb5af3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7c5545f84dd22e41d8c6dc22507e8497db8a7ca2b0f57699fcf3ee4cd6906bc3
MD5 129b5d579fcb58088f19f5075b32479e
BLAKE2b-256 9907e28c601d9dbcf9d99b7065b024cb18aa8b8bc4d1912380a5a528f8580a35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 337900126d35ff27d86887d54788b8b19524d255263f6c4a5bec3b1869bc47be
MD5 c108a9a8cf27a16bd38ef0eaeb6680b6
BLAKE2b-256 0a29131f5b5096d613ebe1062f5e304f6adb8417a7f79f86b057bcdac26d62e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a527f3cfb475e340c3a4ec30e9e8d661f17b0cb5f00425dcddc62c051e0f6b9a
MD5 b6f904ee61add594a43291b0f488a481
BLAKE2b-256 b10a0e62b44f51651b0572d745e0ebfbed03d52beb8178caf0c9ab017f9af948

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 64fe3058ee914676946b018b03ce7a6501c5a1bbb4031dabbaa750d261667d0a
MD5 06ca5e045ea8c144fc450193f9c4589e
BLAKE2b-256 b1e69407aa16680661e156ceaacf4744471bc062a3476f935be869c306886e83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 518f8d3eefb6871a53ad179e3443754daa73e92f281360984775233533980382
MD5 dfcf8c53cebeac9b037f0316304efed8
BLAKE2b-256 5209e3419203869f0fdc53a7f202ad9e82b903fbd4ea6e7ad740e7019333c01d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e88d98532354bb18d8f89b17a88ea5e526562d7fa151e54762551288b7e180b9
MD5 2cb875a19fe2deaeab9ee5e73dc994fc
BLAKE2b-256 cd093344e3b8e967f9e8e573cbe2cbd9c26b177007e83ac24b0c3d455b6a70e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bce82642d37359a18e6336fc59cde34eeb83eb57a00a4ee78a51270c3b1f7ed8
MD5 d2b77c1bb0d5fa94aa34954152b6cdde
BLAKE2b-256 89a720ad10b82624726c41fcf526a8f6daf333a89778432035a01caa6b9c9ccd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408041721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e88f11a2cd7396b28e7840489fe4d51a06e08606af726e478ad359eef8234b26
MD5 500d57751daa714123b721315d1ff94e
BLAKE2b-256 4a609a73a673ca3face1c57c77ced388906762acf9c46282f0dd8263582a4dd5

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