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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.16.0.dev202410171729078700-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.16.0.dev202410171729078700-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3df9b339345056089ec5cf180ee2667c68a59726b6bc54293ca0bfc33cce5d89
MD5 3f408639f7ce3de0fbc8f3520ef4cb57
BLAKE2b-256 77e2ba99865605f1dad68270d5810182e277d2b558a9fa3166320ff1c25e965c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 51b6bd1c7d4ad650cdf73235cf38eaefe07b82c43a1d0f9988aa841a16bb518c
MD5 d96c269859f82abe94fa115a0e8a1cf8
BLAKE2b-256 dd4e81c4513a6d7678e703c52f2c8105e16100362025e2cecac64b421a38b7d4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eb99f45bf0b90550a90dffd9f70927e9e1af3a73023489ed82008e289ee60ffb
MD5 7feab508b835b6ecbb42d71fce928023
BLAKE2b-256 8d20ff9511264c97f050a53254b3a66a6fb364579946d3a0e67d60f7bc85d400

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d489cb63430f5b68275e6c2b888670c1b4f6d8f0024da36939933df2d593e3db
MD5 5e4a9ce641af5bdc6229d565859c6437
BLAKE2b-256 444ec056b15e1ec4eb618a3cb1730431c6821761086c0c39f4782868e1571802

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 dfcda397879db377274cef2257b6732bf59da6e1f0749147a8636b647ecedd37
MD5 3cec314c3f34aebcdd124a99d807733f
BLAKE2b-256 9b31d8571f4a26373f8820716778d1983d1824287cf43f6ad38e63cc8a2ed1a6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 77a412ffb551f59ce9ccc9e1062e150d854012f56456ba67d748b2068b031ecb
MD5 e6b7f800e7906d9b64784760b5ecb9df
BLAKE2b-256 f68a009c2f9618c98f73db0cf917a2f458fbd91eac7d27dc5ed145c300b63439

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ee5dd41b636d01e265f06c47a09cc53c88ffcf5e86e1970aa4d8bd79dac99e4
MD5 0ffeecd004c067334803fae30de2b8c5
BLAKE2b-256 2d851014c30e24d288598dd633e07f4961372a3625e92dc36bb0806700f2d20f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 babfbc4797540e9ab5221eabfd01abeaa4d62750680c43f8ac889d0d3bc3db3e
MD5 60a419592306e355def2ec45658e0099
BLAKE2b-256 ce1ce5a5e086156b14f17a4004aac66eb2b21ccde21d0a4572d469eb41e9800b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f34d379ccf6cf1e67c99178c2c85414169ca46fd7f3bc5ef24ccaac89601edc
MD5 53fd3c6ee5f4cf030f49e9da91c30c7c
BLAKE2b-256 110108ab6e2e71aa5420e122b7379583cd7649641a6404f83be03cab811ca629

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9def9a5fffa91601636e02dba9bd4cc2a99b88faa39c72741eeb9e08b2f4b84c
MD5 c1e95c806c8b4357eb4a8fc8cc68dff0
BLAKE2b-256 882e3da4e1b48066d4c7f08120fbec923e07e5d96e4d56a374fba3b778e9cdcc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d009fa1aa5adf2be2bc378a5bf2f44a25282ad2bafdd794bfcf1a5042ab995ec
MD5 a0cb55a3c384acb70cd3d31b753620cd
BLAKE2b-256 0cc09726d796583daa94505a4fff7003cf4b034f01ae1d6ae06823ccbc389879

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7509f7eaf5b10bb2bd0d4999b32a155a39b3746190560cd3ba71a7dac828d18f
MD5 dd788c42ac274ee4abb057e64d3a19cb
BLAKE2b-256 933c619adad2f4b4d513c0862a25d387a03197a3b496af768a9d4e5251ac37da

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e0a6dface9a6852d4a9537e743b8f15d1a63e3cfecef32cd8cdaa06874ef0ea6
MD5 eef732452c5437f99d83051bbdcf26fd
BLAKE2b-256 55a037565b9ed3db4f726b5452ced92e55fd72360d363792f1f3b42a2b3f9b3a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 576643ca665093ae91f47ec6962e231ebea536b5069579d797dfe5f744a95b63
MD5 7b89ed45d020d20c779ca9d6bf781109
BLAKE2b-256 385d9eebcfd1fb9a706bcf3b66d3aa51d02b7187b4dd4a45954412f288ca6d6c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 075d59af2007b70633e57015076fba4689d68fb33af26700337e8b6c5afd34d3
MD5 1b5e7044370b06cc5e0ea97d4e35e75a
BLAKE2b-256 48f0a07d4ec7a9db68a366ab585bffc4377b51b1d5208c510b9f62c2f94548f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 937210f410bc0564be6842bffeccaad99a965d846724baabe3737cfa1f3a843c
MD5 c2b062a62d2cac540b0c11b5169d6d4d
BLAKE2b-256 007b4ee518d6cd45805c7f69939cf6b9222ac0b9de05139aaf0a44a01a0375b5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 64fc5d420be59b6c0659cfacf9f162f4c7d39bb94245e72a2ec34068897ce015
MD5 e18f02240e95c5d22880572415507f27
BLAKE2b-256 90e18951748935f2511783981aad22bcca0634f5f34d4e65a43b237f074fb22b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 db92fff785b2b2031d9412dfb21908384529d860714ce578a798827e5ab257c8
MD5 a1aa9ed117447b0fa004773b1c84629a
BLAKE2b-256 0df6e8fdfd0eb86cc013f257051b5204b4d30b18abd7f4c2d652e135459fbbac

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7867886675f1b202f99745781465fe29eb9b3aff8a910b99a79fb889e70254ee
MD5 71aee494a0db3b548e777264622cb43f
BLAKE2b-256 ff6d4e702be0e6af76a35265f3cb200e57c6c5473187d0477e88671054181056

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.16.0.dev202410171729078700-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c146efe59ecab7ee24377c52c717d13d9bcadd2a705b09bf90f35cd5b1215dc4
MD5 02e5787ef1c91ee478c310b0bee5059f
BLAKE2b-256 0b0ff6551da459959fd9109eb36b3c9f0f6250dc43465f5e50345d9aaf150cdc

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