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.dev202403161709747362-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403161709747362-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.12.1.9.dev202403161709747362-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403161709747362-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.12.1.9.dev202403161709747362-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403161709747362-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.12.1.9.dev202403161709747362-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403161709747362-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.12.1.9.dev202403161709747362-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403161709747362-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.12.1.9.dev202403161709747362-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e3b10eed663d849622f77a0055d60efb31235588e312bd1bd9ff062f4a816d78
MD5 5dfe4b8d661f3fabec1f9a0bc2fd9c4b
BLAKE2b-256 792591efceb38667753e6431d021ba6a3052a3c2345709ed31242d2308802983

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 45bff695b1505b134c942d556ee73b0c490a2a127422e23cab26a9a4d4b64331
MD5 ebec05e2cdc1e1858dc98117ed20a9b5
BLAKE2b-256 8b5bdc62ab6f8f21d02d8bddd5637f63f90cee53482fc40e1431b42bba362691

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9fa0e80f80810a8c68060be4db5e064cfafd426a4a786877b5751e180f0f105a
MD5 b6948a3fa7b1290acb1a938349aab380
BLAKE2b-256 2f619db0795d1be256a59b6007f46fe51108c456156f2a5a8f6af14ed4f229eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ad86e3cdcec289a1f29416c8206d89da56e4dad87da9ea5e2965de9ab8839e6c
MD5 0420d6f7798a2dea64deb82050c43873
BLAKE2b-256 190c3aba1bf3acbb8af81f8ec6766a3b9f639d01e5907df3bc669ee622fa442a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b24ef9584f037fe3bb9dd62a310ecf9042e0d6f2c3a5efb0b08021ad30f402ce
MD5 e0dc5b3d0be2fd849ea48be797f40f90
BLAKE2b-256 93e4a8581e953c4df65e289f628db84e64b8b554333352285e5e714d3692e8c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fc2524587634642ed2d1ff4de26d1eff4ea470d70ccdb1a52982829ee51ee31d
MD5 8ce20fbb534910e865e0b0b8bae7da23
BLAKE2b-256 b00f96eecc4884efa67f2ee0defe8446c83ede17b4b758da0448b0ce27004b32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c0a0059dbbbfce3ca4289b40940e10b2728116a9139edcfa9f723a13a87a415
MD5 afcd1c94093dc933771bc5c68f4047aa
BLAKE2b-256 9a0f4fdfb19c70c6ebd4f048c261b4f201a809f137e62879245b95aa8e401bce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 800cc150201e598116526c384ad8aa11a3ba60dc081669c88c24c463e7b28818
MD5 550e4de633d99fb9a66f69a387bffd91
BLAKE2b-256 bd2e8f72a6942349d0b8b85680022553c40e967a136f505dfd6a28061e111191

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bc6d566363f308d1c21517372bd15984cbc38910751b1300d98ace749ab7f0d
MD5 f9a55f8555476abc4da14aba723bd6f8
BLAKE2b-256 c7601f49d8d33e734b5d4c3dcbc8fe6377d68087638cc251cb6450c733254e25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 80619c4b3b688041583e22c0e71aa4fc871b74dd729ddd429044b03c664b9ef4
MD5 6ca2ca5c0813b9875adffdf56b2deff3
BLAKE2b-256 ab6c37b385b81e6ccca24dba667c9307b063cd6b3256a3a3ffbd0e723caa669d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 78f1951732458468af20651a775b913a39ec04fd289ce4bb21e32b8ec0c93318
MD5 af650c0d5dbc71ce91146674a3c59fc1
BLAKE2b-256 9019fd6b1c980bf41d39769ba1cb149aac10a4a10ff324026dabb06b1d500f23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f371f82d7a763751b14ba98c2e831cb57ae09400e57a7b221d97c36bfa48cf8b
MD5 bbecfc1ae518f4f72413cbf59a3f19e2
BLAKE2b-256 7371e00185a14f7ab3974dc66ad000e46ba42382a313778b5582cb0f560dae06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c6be552163986c829810ed8e3764f845f7f1c7e17d04f86dc88cd6fd71976089
MD5 383453b7239a9bf39d81807a91c36e70
BLAKE2b-256 e5d952352b0f13497e90ad88f92161748ed6a5132d5cea166ec69a20c20af075

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6d59b9bbaa2ab5cc7c749be7427d131abe43f7aea08664c384e9a72b377f43df
MD5 2c16861c725919fb32c3a0de839a885d
BLAKE2b-256 81bf79b34f37193f1d737b23fd1c23562f80a8099f58cd4114e22aa3ab758fd7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 af4a9dbaf097edf82209ec383a811d03a70fc94465777facbef4a659b59331bd
MD5 6c958cf7a4927cd3535319efeedcb70a
BLAKE2b-256 23a89291e4763adf498f51fdf6723ff363a6781ba6bb3674f8eed3f0f8335a04

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 81a6909564b53b0e6dd1b9088001aca8d632ca8bdc7087df65799b36b394f3a7
MD5 4225c5cb4d0b0ebe4b18a4faaed91c1d
BLAKE2b-256 205f545b599dc7102834b7ed6c43ff1421ef0ab9d15100fe6f29ae92ae75a855

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 75af798440d8dbcd9a61bdad1bea4d2a1e8341ada1e8de57b5444b40e5649d1e
MD5 a6314fdaede7970999b4ce98a075ec93
BLAKE2b-256 e0b875a55144bd98fd693ceac3a6fbe9bce8d7951933200a71b65afc9e335bd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 05a0ae08546f4611a49ebfcf815834ef38b211c153b901052e0305b07f042fb7
MD5 5f8fa55249681eada2ab48d26639958a
BLAKE2b-256 251ae83b15d5d2d2f27ab367c7ca6a08ce919814e3211ec7e0fef19af2bf0ce2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c73434bdef3cdf03ded38bf50d065c2ee1fe4efe4554696f31211b11dae2fe6d
MD5 bd7dcd0255747d678b417a4485ae2443
BLAKE2b-256 3f6e942bb62f4afd2a9c4196d20f1f13eb3542b14735914ad1009f7cc7d83620

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 819b533bd132797bdb6f0f5f45ebb9ee1a21947dd9ca6846e887dec037dfa459
MD5 f3072f2ab5ebb724ab56215c2a9b1235
BLAKE2b-256 e0094a6e7362f1d9fc7ea47a50473e3620be98d513c7ead2cd70afb845d9ea8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 df5c64596c6c591d3c8c41184f699e4da204b5e3680a8551322b641d95e99c48
MD5 c24110b701f7e59398be46333ee64ba6
BLAKE2b-256 80a7e622e0d4efa9b944340f2fa9a9d8e3b2af8dcc5863ae34ccc1276f453bb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd6c231a24782b6473db299ee982d926c109ea847c5e46700e8e9844de9c2f5d
MD5 f4286f7bb1bfe3fb392ac475754c0631
BLAKE2b-256 2641a1502ff78095ecb007c961119ddf55694471f37850a0a0d5733ab0ab7719

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8bad3641cdf33cbc636dfd316dda73f44561620c16524e10a7c6e6a388f73111
MD5 b1de103b2e92e163239c45e05160da2b
BLAKE2b-256 399df547f94a4feeccd4417f201cc38bfe0334321b2d174d8a593a69a15bc253

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2aed5e0a3f174326a648e3cf61f23ae8311ae1364065f579d24d98be39a9593b
MD5 4b0d1d148ff03ef4d61aba594acb32f6
BLAKE2b-256 09cde48f618290b61e0decd1011a49106db93c754a0e74a0b149eb2fdd77042d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403161709747362-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5e4e6e54451f245d020e5b04bd734ba8dfac2cbd444a4618888ed72f79bbcba3
MD5 e16e195f23c67f299713e44bcbc9e259
BLAKE2b-256 7f7c64e90369fc69b124c055c54e588a0ae57016526f41a6cb68081bb061e576

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