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

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0ed5a5837dff2a9d63654e73955846c63718b74cce8ef4a5a16221390a91ab51
MD5 9f8704f65984347021a102773aa85523
BLAKE2b-256 849bab0bbc9ee798810ba9fceba9776f136b29c9b2d106d3b590f7b5714f1638

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0b660d885025b1b0ea6c99bf71e16cdae9967e8d74c06efdde44a3ae21395950
MD5 6501582df1f15fbec416bc863a89e612
BLAKE2b-256 492c331ec8bd6c4a548ef2b76350e37cd3250ed98624e4cdfa1947cc878f6413

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9205998726dcdf1076e683c44bf3c8e301a662a79b7e9e964fb4747f22ec9bc6
MD5 6f9db6a93ed55072798d97962a41ea7a
BLAKE2b-256 12818729748ac8aa3dc239a34e548031a40efcd18808776d39b752caee4373a3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c99decf686b2a0452d80e22bc1fdcc9e126bd5f8fb26fe4a844c53a4f4157a6a
MD5 d635fefaff77d1b48a0c6e058f30f87c
BLAKE2b-256 6b7cc3c29bd9144bdfff2a33a6ccca31d12fa73d88ccc875c67ef4d291a7c324

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3b7db9595014c13f58251507f212d28cf86aff4ca0dc075252ffdcca145421ac
MD5 5728063cdbdbf6cf2eebf10727c0465f
BLAKE2b-256 d6c0bbbe8b344f551f320b254446e0d3b33e58e5b13a7bda27dc035f2ee689e7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3d0af35972b41878cff31857e39a5b011d83a697e0439a58b3a3d32718cdc5f0
MD5 550c0baee4be4cd7592c4c57b9f6935d
BLAKE2b-256 7ff412789adb53ab2fd4c15cf13fc6dc742bc64dcfd92c0523957fd2ae119f66

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 37bd93d253e5168ef556aa9b5c06da78a42e0719dde9e47504803d71746cfeb8
MD5 fb4b36012f9efc5b0b4189cd582b85a3
BLAKE2b-256 3de5c2bf152be7da7f03a8b9350bbcdf0f34eae4206ba11b9b9f2bdb3cfe98e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4780b24695a4b9983c37d9d51049eb16fd6f690faad6160662e9553173cefa3f
MD5 3dcc1a61fe4f8c764af870f1bb978669
BLAKE2b-256 ddb836c3f14ffa1b0952be014f31f11dee62847655728f4286f61abe8394458c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 974c53318e3f72c4fded9ecd8f9c8fca132cd4686c743a3be3b1e96a309e0b2a
MD5 52681e7710f0fdb6998d14c7fa577b8a
BLAKE2b-256 8c4f9c5d0933ae2b665ffffadba5c3c8b95bd8852113534de977b7f231678665

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b16c4d289390aed5fb4efae7f7ad458aeb70760ce83fd4a9c5135032004df526
MD5 72c6cb1b99fe395e561e15a2bba21be3
BLAKE2b-256 c2397a7c5df7fe6e90808ed965e0bdf3e8bd164190775a5fb6c717664f02ea7c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f95a84221a2e34b49a2f08165f0b5707c9a04f026ff15adefdee289263b2dba7
MD5 ba930f9ddc070fafa17ae12cba6af6c4
BLAKE2b-256 c4f19cc5ff7db6c2ed68f596f941a7ca635fa8669d2513ade50c85a8cce20825

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a1d9bb9c4b7d99816a5c1cb469e71853af287717a3faf6803f02826c3c186ffe
MD5 8e1e36bec5a5042c078edd8ccb139730
BLAKE2b-256 677b3ed29448917a8fb83b01c1078034bf3ee95c7343248ac5dd5ed8daa42db0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6c3daf0f990a9e47de6c7b89a0aed1aeecacab991faa7d3944d872714e3eb664
MD5 1ec595d38ef2d5cc433993e8083b21de
BLAKE2b-256 a519612ed3b3100319bcee6e8279cf114ed6bd5ccf300c99d0046299f72d6853

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 afc7b4b3f88d215f7e7fcd53e2f48cc7878f25975b4d106cd935c0e36a9c4eb3
MD5 ffdfc294577a98c93fda3eb3181c5861
BLAKE2b-256 3cfcb5b6c2ba3b52c622e98d597fb43f1838a70574e01d890173c2ace168195e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 578653925ba56ad48d807f303d9e1b4cb5824b20b0fe75c71c6ae244244c1209
MD5 b0e7dce2848918e671afbf32b1c22072
BLAKE2b-256 9cbaaa3a31756a3eb84b5c84c8162ae8eff81e9a08fcd9b988bd079697dbb54b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b8fd35258e00222faf999daea009d5c7ed3f58652a8e9ea3f5c68f95a0a4de4a
MD5 227fb3eaa7f4ad71e79a49bd04ffba7d
BLAKE2b-256 d792b1317eb7c1e59d7074b7fcef7523a4cc5e3d1989679b4ffb36f79cc30631

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58af25a08cf503ccd36330b9cd5614246fe803a30a690e5a83484a400a95abb8
MD5 03a545ed74845fcf018284b7f7a417b5
BLAKE2b-256 d27e91a5e8b0307fe973d0f595819ae7e9b7b91de97770ec6130102436c43eff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 024b471e80488c333528c29864853a8bc3b3f2679c9284634cc1ec996deca227
MD5 cc43c63c051125de2ad8e6ffa8b829ed
BLAKE2b-256 7298fc0b5f2878b67d6fc39f26b7b36b81165e458dcdc6b483a3089620579759

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd92a794d70f0ce243c01ccc36ae744b5ee1f471d16e1a74782147a1cf4d5dbf
MD5 4494ee542952f2bf83e77a71407847d1
BLAKE2b-256 827906560cf4db6c22f93e42f2f1694416ca6913d9ff956b70c5b004d0541640

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409121723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 27143015d8b0c41c26f29d6a388f01b1f656aaeeebc16d37489eb5f972a54d6e
MD5 0b5411175593e20c3a533cb7d75035fd
BLAKE2b-256 57a2276e36cb5ec26015e119b3fddc4155c8fe0de048effadb706aff36a7b089

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