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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 deb2ba09b2990525b67be3187797a5d0a77ae4ee88534b483bb0fcc804bd9a38
MD5 c869cb5a498da853280b2ca9df10d4b3
BLAKE2b-256 2baad53fefb93766b0b7c53979df85907cbf3eeb0578f2c72ed4f3d3a602f0cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3bea7caa030b42c7a2fe55348f314ccfdd99d1a42d6414a7d35eb60a8de71b6d
MD5 321959f62f3cd093aabff139613cdb08
BLAKE2b-256 2454f9a7dee3138e9aa74d52e3905b203b91c3670b4cf6b683d0da4a53106ab6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 80ce0d3a673d1a48008ec1f58c85820b4054aeff4f72a94f14e03e581a7b20ae
MD5 15f189288257d52a3e4ecaac4cef0113
BLAKE2b-256 bf91ad9365776b8f99235f1a8a405dc63dca9ab92a0ca1d616f42f52ef18a055

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c7600a4fed284e654deed95b7f18a6513adfd25f585e8d48739a0cf6177c263
MD5 d1f1239f5297a463e7c3e10cc4d0361d
BLAKE2b-256 0afce5ea37ed5a1d77872dc3d8361498fc86319a18d40ea155b54859f3356eab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d9d931ccf77c4e95b592f65ced09176f7dccb5871fcf74f849da461e6f29727c
MD5 4bd69f92f8ae00e3951635d85d07201f
BLAKE2b-256 e688f0139ed7133ae5278399877f4dd637770d173a16dd3825c8581e9d9f93e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b450d9847c8e39397b37fa784af79e952d4533d0eaa6987a4139debbfa453cc3
MD5 9d0320c251fd7f21f8e5d90bed8e45c4
BLAKE2b-256 c3bd562b0d870a7492dc9b4527368977727827efabb1e491837a9e1d3a7049f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2406b2f0936d05120389923664481334488747ec5af9f7a985b47b0b820d6512
MD5 dfbe41c80e98359dfa7c1e6b8372b322
BLAKE2b-256 25c358d4dab22b3c0534ac3de9dd1b03dd52e4ad804d25aa8087ce2855d04614

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e00e084acda605ef1e3ff64e02dcfbda02b89a9e0d11ceb7e99e68b86cb16f88
MD5 a2a103302852849749f0f4d620ee595b
BLAKE2b-256 6643a07e0168269e1099ff2fd83fddb351058890aacd9d2809e979fc6e56485a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff18986fb8f3a42e84c4b0b3d5120c586a22058d1f04b8f82f33fc99e02773b3
MD5 c29daf4aa820fdb711d021dfd2ee671c
BLAKE2b-256 a502b1cb7db2f49ca567c1f0ef50499698bf738987e24443b7e70dabc8a7c20c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d2577bd64aabf6b4d261bc85f0127666da3b7d973fcf1903bc2a05802fe0c079
MD5 d1c041d29be6c632f97d4b6b9877a329
BLAKE2b-256 cbf06953abfe27c1a3eb3b9f8445941a19e357417e8978fc15417311ada98086

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 638cfad6d7b3faade606bcf94bed603d594b298a7d863dd3130f556947ccc90f
MD5 7b88375778ba2839616461bc54ee3af3
BLAKE2b-256 660055569ce0baa67ecd7a66cd105e398cd907bf2ac3e50c5cc84eeb93ed97e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 577e3292b7a6ffd758629687b16d1d4e73c96e9a67d538aaad1bbcd5a54b1df0
MD5 5f0c2f7d6d2a85f3d5ff2ad27326e07d
BLAKE2b-256 09bd5fd73335d6afbefc77b72eb0337ad7d8681e85e421ceea38c59e1a061eca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1f87f1443ced5052af51567cdc582cd7db860dbfda5ae9937c4c4aa5be900034
MD5 7ca1128dbe426adb6296147efd3ff7bf
BLAKE2b-256 d30d46b00ac1dcf65017b1cfc3b65950bc5cd8b1a993b11d5acf6a039a398404

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49bb6fa3f4d74d2ff0caf5e303473a4764e8136e5afbe80b3cd11286bc2166e2
MD5 9a5b63ec395477b1dd24e1aec6a0bb5d
BLAKE2b-256 b7ec9f1155c081352629792d034c042655baf9ba04ca93eb76eeac88cc28af03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 48c49e34911698017980bb37be6e5b35e6f5f6a497eb0eb8320f45aa350782f8
MD5 683eab5d86bfc1ba9fb3afc113920bcb
BLAKE2b-256 086a6b2dc4bb1a9f8344fddee4af77914022e7a268822b62a5c028c2183b4fc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e9f0728d2205b1a403c298fc9192ee3e723869868059b24686626eb1b9357a8c
MD5 c2d61862ff00cbe79c2798542c0354e1
BLAKE2b-256 d9257b4f5bfdbf3f54dd307e9d88aaea239ec6aa33e903e22129093531c661b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6eff1b7a7c092fb855a16d93853d390d6070355201c3a34498ce0aa44580746a
MD5 b753f013df580162b72c409a013f6783
BLAKE2b-256 563133d8ed77d8534e0ad31827e56af74eea16e088c386e5b64cc017799a555e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4f7fcdbab8bfb64186bb2cf32c8646927fdb8ebc9388d970e03b17464c9200e6
MD5 4e83a64c99dbee499c2e3cda1f87d4d5
BLAKE2b-256 d8f1cfa4eefff234e0359b5fcf61965cd84e53ec3b08a86c8d86c92d749a072e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 393ca18645720d9e1b8d0859f26e34d54ed71b2c27ee974b00aa3621980e1cc1
MD5 744b214fdb261928ff236ba6f1e253e0
BLAKE2b-256 f76d083dbdc0c1388f1c362f91139bc274d9c363d63fb770255c3fd6e82eb772

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501301731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a5ff4e008f2b007ae81aaa8ebe61902a2c0d67cda3e43bad3f0ed467f9f820a6
MD5 a7fe3af9bd82309e35ee623efe97f2e2
BLAKE2b-256 c18a8c4f585c677487b6eee081503ff3e9dc17a85cd12b955a5712d5cc33a247

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