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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5971cfd83bc78d3f1fe334c0259d939bc2b50f6f6c52361a57a0abe68d3aa20e
MD5 ee93c3f51d2a3ce578322c8555bc156b
BLAKE2b-256 92d0c825c2654bdaf610a9b7040d76fe90bfa66a641c387ea0e38daa0088fc9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e936ac61196a3daa5d76c9790189385d378814a90fa47827689f391c31f4ed40
MD5 d7d36954aeaf43a945b7a24e7767ddea
BLAKE2b-256 d15f19f9494c13db5a3b2f32978fba525dd1ee69887d07292d3831d88fbfbbcf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 72c6ea4fbeb929915a9303bf4b2c33a5bf041742baf8be4a164c500065f0b21b
MD5 0e591d2c9355dfe138cb289f82698406
BLAKE2b-256 0ffcbbccae599f00dc5ee19fafeddc0db77de14eaefb26a346b3d2e6c3167d32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 17f93cee89f0879dda4ae338cc7bee31ed6529bb5fb0db760c960d90095376e3
MD5 def5e5d30d495960aaeb603b70f04902
BLAKE2b-256 638253088001341eca332ee01e90618b2758e81ed5ae4be511ff26a960d03b33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 26bf7bb77fcf3f9e6e9ab3280c83264e9da9ccdb43f9121561b5e9a8d3214d5d
MD5 b31506069f06e442a0faf84bd94fa146
BLAKE2b-256 b66326826edd040badcbb84ee0b29f8d0808a7aa8d567fc1109f5f7c490384c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 53051ea4d339cc62a05c70be450d5128c2f7cc5b0e96985112a16028466a801a
MD5 34867bc298b76f66aa23012419bc8f04
BLAKE2b-256 f4fca50f19356af64777d10ee48e35475acbe2c91285027b61dc2090658736c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30fd6eea009a1ffb78a3d44a63b71527548867af419cd45db5300f05eec1208e
MD5 10d36d26173eed7321f2a490c307a48c
BLAKE2b-256 6e4455efcaad6cfc3fff83642a0b49f8a4400b984ff88e67147d9543311bda92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c17fe8a03bc1a2d9ee56e12e38e067b175961322d833d3eab9341d65f49026b6
MD5 010d948e5fa7ee3a1ed56d70ce10f2e8
BLAKE2b-256 dd2316a34c30933968935e2f504f3a86eb7dba0aca9bc0232f2831bc1d5a3742

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f38ac5ecda8f3259abc7da694dd0ac7f96d9139559d5f32a795c01da2365eb2
MD5 a1c1cd46ff425fcbf29da4cc986ec82e
BLAKE2b-256 f31c0c2f0a938333dea9fd44e96ff09572e01152f957a991a267bab2df436ce7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 08ebd0dbcfed6ced701c316c7d620f099c8597e7098b4163e9000d97741b5d27
MD5 d79ce22b67fe999d6b2368de3da698d7
BLAKE2b-256 8bb657ac46028969ddc9fdb4aae006a80c674cbd8606b88cdb5b18b7ca745347

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7a3de83db4fe31044139df997c9fbbadf91faf4fe18b72ec737010cc22035318
MD5 4caed356a00772ac90fa868d19bd5117
BLAKE2b-256 98e9a3232470bb177bb4b6efdb1f06cee353dcf0f66fcc4a3ae80a36a4b85051

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7ad79e215b38cec8dd81f8d13f8bdca184507fa53193950761570c7c9cd913d
MD5 f138df536b163e67bac85b04aa01471f
BLAKE2b-256 bb41cc44e89fde70de96e6dd03b00d2b0a0c8c68a249ae7f607242c38d84c4db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 009694d40d9ff307daa01298cef13bbabb57f9f9295cbc36609033b1ec324150
MD5 2519c6ded68e0cbf015b0118e69557cb
BLAKE2b-256 7917bc3148f1c4e9f2f6247fea0a895ce4fe99d57f4938664d34b2b01eb9c7a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 286b679f512c9954ed92fcf307ac4c9abdaf2619e10054c1687c7a12f8da838b
MD5 f0dc367d9227985f0ebac0e69e2c327b
BLAKE2b-256 bc94a981b4fdb47dac2bd0e78e050343566c3d5457700b50d486f8acb1d9ec35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 054649a8f77dd6b9b6c8206397da3c809515dca9895610ac6da2efb7a88ef087
MD5 b6b603f5f60927666ba08f1d93ae8a20
BLAKE2b-256 7c1fc1937715b6d24ecb318720be5fe10e5751b0aa4fb887ee1dc04fc46b698a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e23f598ecfa1096af3331610b9ed0889d05ba61ad411143f250568631209857d
MD5 adcdd13eb2e9e8540490df6a0df17bd7
BLAKE2b-256 a90723fb3152148c4716dbc5b9f0a55018919c997a032e158d3f6e4c66ac690e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0534d714d34bcc2d91a3ec9af839a236f4df23ae9f9d9ec022db623e4bd3a5ab
MD5 3e16cd3c00e83e242bea0763a9253631
BLAKE2b-256 936d7c306d6e74563d6f011d92bf8e7f8bf3334c14edfbb0b408d1a24c5514c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 190d6c3ab2bf14224e04bc1305523c49fbdafc0c4d83224cb811512b3cc3de7f
MD5 c6bc857ce62ce1ec14d78227149ad3b3
BLAKE2b-256 b068b4b2477250412905ffd755e201c6878e24d780d823a96a42cfdf6313c4d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f09b654524e85bf66426973162a60542e06b81d34092a187d26b3f07d4327e03
MD5 2ef1da5d7ffd415dba21b81b01090095
BLAKE2b-256 dc85d83f39c9014195f6a114e64df75ce1151394aa540c23f922775ad56da842

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501011731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 718bad45e3ce0bebf5a3f6bfd87718a85b37e4fe2ae180844ad16f87337febea
MD5 ff574e5ac5ee0ab5bb1587918f685175
BLAKE2b-256 44f0ffd139c57f1f29b5d52f1d78edb6613fba4a042bc3aaf316bdf07a07a57f

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