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.13.2.9.dev202405221715182293-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dec34050f659e887af62e5a4a6b598cd74eefde8d466e5bdfb0bbd13c092b7fe
MD5 aac5716aec635231cb84796d89892dcd
BLAKE2b-256 5542c48ada3f04f936586ca81681feb1d205ac26d993757c7f440e4318906077

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 295e2e902a44cde3ff62dcb9f423b8b858e9f13edf8198d2f6cdf360fe83a0c2
MD5 3906cf1825c88cba377c4d22121ba06f
BLAKE2b-256 faed1dc48136f7728ef1f36434207e4bd5ee0b32180092af277587226379ef6d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 936e2a3dc3839ce11f5fa01db60f741d30afe3f5059fcc88102652a89c48c1a0
MD5 1ae9c31d8ed6a71388d5562a09275821
BLAKE2b-256 e6c36b16ecbfaed65a20fdc2348527ffb6c6a29fb20a919fe47df788b289adcc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6a90a55b03a693023c86879f73cc299ed1aa1b6c9e93b14548c37ccb6aaf53b8
MD5 04e4fcca7f55af42c4197fa459632647
BLAKE2b-256 2b90c471808057bc71e2ba7365f0cf9f341e7ddd99459097523a3ce0b6a10479

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 71fc9f34dd00f73233752e4f2dd7f43c4624b77539a25e1318585075b725ecd8
MD5 b875d4a6f158dccd16f1c64fcd346372
BLAKE2b-256 1a0759d8630bed4381f3455ce50c66613f4807419e30ae54253b179f9ce66791

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ce7632948311cc57363ec07772ce7883897853410df39c45c8ca2fe994f45be7
MD5 f0a0e5b476694257d50f4bef391ca0e5
BLAKE2b-256 5a933a22016982d14375d00e90f2490987a2b820dd091527de1454103514e5ec

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bbbf25e70540a9b2aee6af33753e1ae9ecc23780823b0e96d43fa099b6e0c238
MD5 3bff840daa8ff4a1461bb9f989fccbcb
BLAKE2b-256 c24467b8d6129a231da25a8e50155629cb537299fb26ed6031a09662f647c8a3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 77e2ba647527fcd6e70b1ffb7c39629f84ea4c8d00e9238fa90ab5ba318a70e0
MD5 1b5f8a16141b06f977c7c5895a1a8220
BLAKE2b-256 908f3b7b2ca34f69600bc5c849d43d214bd56391c1df26a2caf20a2db7d86c62

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb2649f8dd7321cd20b0f8b1b6ec9aa3b2eb4116130f3da07cf920e8b57eb813
MD5 e5eb4fb18e3995abff65e7c41cab3bb9
BLAKE2b-256 54467686f909f1df9a1f518134e3b26ba118c43dbfeb603228b6acbe85832c40

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2a47a9b87cdca16cf308f6fa0dda1d2734c63e3c1f43ad4b2a6bab41d8d1adf0
MD5 9214bf22f15e5b173776dcc39ac48f0e
BLAKE2b-256 d65c471137448dc37b2aeb2e2895de6cbe89ed188b90d12f7ce046c85f0b3e06

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 80a3793f72c750abe635436da02f174bcdd6c2769e8eca7ef9042dcc0e3c38ef
MD5 bf33eca5551d16ead69ac369a5dc90ad
BLAKE2b-256 2e02ce1f3f5022208dd54f49c851da4a5f12909d4380f24f57bff1570507c27f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a4753aacb19c15192ef829ab0c9bd016b97c1aea535856bba4b969c3da5e90c2
MD5 f1b6c9cd19dd1dcf576aacd5d19c2ef8
BLAKE2b-256 80afb699f82db224fc3d9b83c7d4343cb28fa62ad402fb222468fe026525b7fe

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c653ecbe36a012ba3eb6e15ef75a3be3354475aaa1d69818f0425314862e6f66
MD5 b2281561f9de7674c1a30d4bb38899a8
BLAKE2b-256 ea7a3c75943ca6e0d1e35a6850e0d2b473e2f31eeb5e607adf7a7c8b7d0f9f76

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9bc8270b2750314b22db80b919b485c23462e0468a6cb781419a6611e56c9355
MD5 81f04877e50a6c1c31c01cb5e0f5e099
BLAKE2b-256 a6d7811db597e7c03dbef129c8077127d7bd9032f461bc72e8bc1b6ed53c3a77

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0e1d5ce046ca4840919433e7346d8ffb64b9f59ec6ddfc19f017cf70678f1f0c
MD5 7d55d891d1a1eef25763384898fc9582
BLAKE2b-256 8b1c297fc7023b7af6a2b747d643eee5270b81cdaa0fdcf17feb993f04769eeb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c59d9c1a002b8c404a7df83522ed229465e596e51c4ff8c360a4ecb17d496bec
MD5 3e7e9132a6d0b0b4d0d85f85eca9fbc9
BLAKE2b-256 1707d7fd085ffad45aefd71f1901658672f6b9f3a21a48321c2cfba450168af1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4897ead584143d30cb665cfc36e7a5a32180e461023f7fc30c8fe32e5d20b1c4
MD5 8cf692b0f4618753f61eb088a9abd993
BLAKE2b-256 fcc4104d1e7baf958e1d4f133a5798c33bdf9891d1a5152938c7672e80a83141

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 adeddedc5ae18c6f72bb1598003f34750360aacd7b8381a4268e5919f38532ff
MD5 a50bfb1722ea5e3ba384a608e3057a4e
BLAKE2b-256 530b98c90ec961f5f4da3cbb62603185bdb0af898528a91b80d6c1ea4696d0e4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ef4877b0e4a952d585a9b6f9a611b987273a27ba29f12a186e61db87275c106b
MD5 f8715817ced919cfe4ef6bd999d52ba6
BLAKE2b-256 d641ea82707c24d0e8944218f325c63c1a92ebeb6aabf477c21d9de8c876e776

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 83b53c69ca423d54cba7bd736d95f3a57484f84b39773e4f2282613f536a276f
MD5 5b37430c80efce4ad20a8cc71974ca94
BLAKE2b-256 d5f91f4982ee6b63ee3b624e73b0da83ad9c6d9ae8e6b7593be4d59d4105a9fa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 96dbe066724e37b3904fecb27b7e56e9a55fbf003c6f500e6a5cb4e7885751c5
MD5 0f88c271dbe162fe5fcd77d08e7df3e4
BLAKE2b-256 2415c5b73f637c798e0749536fe58859796c3e61dfaba5f64dd6852d61e374d6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 107c2de6c1fa2b4b098e0d76c6a508d88be680a25f69f40d1da9f6e2f11bd099
MD5 fd634976a32f1fe7ad23b5a8f158a6dc
BLAKE2b-256 8c1514a907d79711bbfe2d8d4a755aeba98a4f03abc39acbb63a3404cf4726a3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 be34ddf87d6d97cc2cba46e63e4311edab577ba93e8deeb2ac043fac2401a4d3
MD5 5fd4380446a33ea7330912d1154dc1c6
BLAKE2b-256 dec158f062c936dcdde312db89e8ec8c3411f1097f704307a91b8b031fcfe242

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b2f6f9cbf0bd99de4ecbe47c4091d07c0dbd5bbaf3d624c3e616739badd7a2a8
MD5 59bcd8a1500f525a0eb1247c9aae5086
BLAKE2b-256 81d5657287b618bd08f83dfdf2d2463cef4c1c26a035561b376bccdcb1f0848b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.2.9.dev202405221715182293-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ac7502f52a9aad0c81af8463d030325c40a8399cba283722942249574afd3348
MD5 8d12c0f147431d49e705eee9c8c789e5
BLAKE2b-256 7611f64ceae23f0cbab65c657bebbc0d10e5dff861dcc389cb8c70e6fe96cf35

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