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,2023 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

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8cd4145dfb59e95ff2508c258ecea555e0488fc6482e82c5b841a43f0fc88d38
MD5 a9b560b6cbe23d604ef3b33cfe21414a
BLAKE2b-256 464cc82927f8d573b86a2750b08a39265a863d057cad6fa79fb722d4a2a7220f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6215ffeb8b5ea1cfe6bb905844ef6bd252d89fc41417b9bb6f3047e98161a06c
MD5 284f85fd0c2aa359d98b3a8353b72558
BLAKE2b-256 1f3597976c79c5df32212eaeeec26759c2ecef9dd2092e27c82527f6fd1819a5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e258d2d7e8e6907a92dd1ec328567c3f0e919d96680d165205d51cafd6deb21d
MD5 882a111e3956aa6d1feffb1476449c20
BLAKE2b-256 1fd0e69921ff038f45219153d006713848b2d9463486a0cbf36c3992d8a1425c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dc0edabac5cdb839679d991052060973b72e940cf9995ed561ba55bc81338f59
MD5 16a7550efddfb6fdf67856648f8302d4
BLAKE2b-256 3e19aa5f327301a6cc4070909b79a4542228295a6161dccf874ba93ed20d2f04

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 06aeed2de4322cd55459a7132f64fcbfc44d678da142d38f9acccf8af31866a3
MD5 de6d7cf0221944cb24e7edc424776efb
BLAKE2b-256 b946fce2505dd781fef41045f11c1ef82693b50c1d0b340ac1b8d46e5a8f634a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 07539bb572cf0cbc51f55df0f893d93405dbf247a00e72f927c555205bcc089c
MD5 f75dd1d7df6ce94417d842f545603433
BLAKE2b-256 fef3543b704743858763ae5d621340ac59875a0751efac18cb2143bde23c9129

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9c93b6aa9e12dd22b5f12d6f026417556548f1b4fa917f6faa2bdf53fb6cc966
MD5 d32ac523579a3d20300b69d8faed4175
BLAKE2b-256 ce14abb54914a231dc7522c81dd87370434dda5ca4305ca2a5302f213233f0cc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 164dc0318a9fc7ad3a1500a4e216767318681140cc2625474dad35c7fc1ebec8
MD5 249ec9c15e445ea9611385806e954ed0
BLAKE2b-256 b3f290962fe65c81ea08508ddeb00e1a98241fa31899281ffdd69433d04276c6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5ce5a2949e0ce689785499cdb430ad6c1591d34d68b4775f820588d54822de8
MD5 37c54b7b722fdcb8a462412754cbcbeb
BLAKE2b-256 3e2056036c61c3f88e8834fbeb4389fe87f745f4b196c4be0deba764d262cb08

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0042359e429e7f216d52a29db89b196e80ba8541c51a526590700e43d3dc2de1
MD5 46317b660988b34d3b6cadbdb71d1de6
BLAKE2b-256 fa733b9ea265385e5b9659b419ea18458f98f94f4a34355c3193fcd6ce25955a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5141d2c35c9985a2f17304f8c2b0a244602898d9efd4af41308805fb4ffa9106
MD5 19ff26f4c333b4483d2fed6d83bc8684
BLAKE2b-256 1f86ee25c32da161d8b95e8b30a66090bed14c7b8bc87450277331e368aedf18

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e5266f28252a70079d63b579132a99d8a86c0f40cf5005aff20794e2907ba214
MD5 4b28fdcac87f7ac1036a940e7c0a293a
BLAKE2b-256 a8704d1581019561e1e18b518e2d21c62fd176f57b3ca8dbb8bc975d9d243ab3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f2694d5349c66abb2eb97d669b97302ab7b0cdf5a3f57e03f25403752dbb62d5
MD5 3ba1c3396edc07f7783235a63159b981
BLAKE2b-256 3b7db7685030d956cd6ac05bf12fc88f99fccc7e9bbab0827c0b841f8666cead

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86151e33cfcf4813b805013598d2c488cb2d3ae72cf6638b5285478d064be755
MD5 1c49cac973495e9bbb767bf0904a2b61
BLAKE2b-256 48237587016270a5e3898710ddc8e7b8bae30deaf58ca68a80ca862e329ed881

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d3758079c0fcebcf362a76a8612bb7594c4710c53bb16d7066c428f286c6edad
MD5 1c432521eb0bf6d9fbd24d8fd5ba906d
BLAKE2b-256 654ba9d0c10e62eb9c6336b0b124b53c570e2f02988ad685a5ca227bf1abefd3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f677275e1d22ece756ad0549ce4bb61641655027400bfcb234142ca582646176
MD5 fecffcb4e6c0f0145529abe5c4cbb44c
BLAKE2b-256 e3772463b29677fcb9b1dcc65910127b02b6c2d58e50d5952156dfc7086c7a32

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0836fcd1a0f8cb17bbcf424a0e1bbd696947440e98ea9d01a874a8555e7822fd
MD5 ccffa15decce1f5bea89a634dbd83e55
BLAKE2b-256 c5c2ea2e0d2b82428c5be6bbd350b082f293ca38a6528e4bb227f4099d61139a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6eb938d7fad82b4dfbec409fabf96e55cc7f4553ef9908f42f5e303b821a87f1
MD5 2d1a5c8a19aa33d15c673c42ea674d20
BLAKE2b-256 96425f4c9e9295b46502d019d792f1af1f5554eeac0a28d196431b64de086562

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 17d24fc37cb9a285affc549a6c4c5527fc71ab4a21e846a54ab3f811561c2691
MD5 5b93419a88499f264c19bff3174225db
BLAKE2b-256 b9f5d3922dec17ca26186a2f31eb43a458dcfd8a6763ad24c159768c7ff0b89a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d36b1da72dad7e84cf162d26c33c3ff4f807b3ac45a519d7f3102b53b9c727aa
MD5 7af5c049151bb92e82dfcc6b764dbb8b
BLAKE2b-256 cbee5791da3165fc7c8bc6622f1befcb8d08d61db32b2e3b0f2da5f91735c2e4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 32500d9394867ecd9bbff77376cd0656dae5e579a67a467f4c1ba31d4be65d17
MD5 d174856d2fb835f2925dcc7f63b64a7f
BLAKE2b-256 00da9f425f184f4ec43aed51df8e4d518444793700f00e362bebca8db56a6ee9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8efd442e8a915fde0a136a1c3f233d914746467e759d7154b77f330fc22f35e9
MD5 e397f5c91e18e3df436fb755cf2940b7
BLAKE2b-256 803b7bd5265458b676254e9eeea0ae24b4ec8792a928d4025b1ad8e00b0e5b52

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2e662115db7a947165d9713724992f29b2babdb087d3a656630c32dcf910aae5
MD5 7b59ea93de73f11b3cc8cb045fd48fce
BLAKE2b-256 d9d2281e4a7477e6193495318eb0187bcd689f1f5094fd530b115449872a4c5f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d2f23a87398a9aeb713e7b33e99f281866aed6284864258ff4c77bb364ddcdc4
MD5 0c7f0dee6127275d6154520bc9e9c648
BLAKE2b-256 c69b406f9a31590b036b3eba6183691ed4ccc687f9cf77c079b09422e62fb027

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202402231708630418-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3936b087ab5dfbf0f9ab6dc7383caf9b785efdb82cd2e3e8826ec4031512fc19
MD5 87d6645a00e2a1ca0fa96b260dd95547
BLAKE2b-256 07445a307fa5fc522f2940245a5c7002d9992be39872fa6ae0211e728b62e2e4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page