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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202402101701813464-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.11.0.9.dev202402101701813464-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202402101701813464-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.11.0.9.dev202402101701813464-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202402101701813464-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.11.0.9.dev202402101701813464-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202402101701813464-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.11.0.9.dev202402101701813464-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.11.0.9.dev202402101701813464-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.11.0.9.dev202402101701813464-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6ae905cdd7a0db8589fd1ff9d86f8de0bc4880ff5dd34512bd1957ff33cd9d92
MD5 48f9e1db7bbf65a4ab001935fa37d69a
BLAKE2b-256 0fef4d94757bc605d399170307139ba48dfd1ae9b7d82e5a2a6797c9ceef0ceb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7acf2fa214e7d333008d66f89c2f9b3a53e758262917ba4cb1cab960d362127d
MD5 8e1d76461910bb3b3f598dd42d7303a2
BLAKE2b-256 581f85df1584d71816299338db7bf6bd0754c73cbcaeb5aa853062a2da71f22c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ffa50e4376e0161edebae371e445a37a592304f538b0a7deed663b6d9fc7747d
MD5 7277fc460db0fef48fd406953b9fb117
BLAKE2b-256 462f88604b71ed66c66cef8fdc17784d4a9db7027a882dd82d1f6d7631bf0ca7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 631b27bc29c19afb43ec3c1f2c8dfcacf103cae86d99f6011e6744bd5cac90d1
MD5 bdeacedcab939c11413d422f86f6ac70
BLAKE2b-256 239ee35fe681973e8cbcf87c26310e0127145b369d24357afda14774a058da7f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3dfa835c1702288370e6175ad0a39bc5704b4bc5799cc0a6a55d041ea81c5431
MD5 f9c80e78cde3251285aea300f536ef7c
BLAKE2b-256 b26776cd3f480a552a1f2f7f32cde7031a8a59f0fa2037bc04bd9eda114a03e2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6f595a8eb6a1e8497538844bb9777da4aa750d3d662c4130b71eddb0bfee0adf
MD5 61746b2eff180b784d11518b9f4537dc
BLAKE2b-256 2a13bb962b661c1e8f371fe1399c7b10a4dbba5381d7d5f618edb1476b890f3e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4df50bed62149039d5112b5fe7515821e3bceb658308dd43498a4d615769a95
MD5 ee8e537b95e0410afacef7f8eb854aaa
BLAKE2b-256 90785206c651f3678008d7d90e74aa5de76e97f66f6a01008c380213f6d23bba

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b7e01318b1ec2ec5ed2e9d3b0f43d727e8a46c209c1b80c48e498ceb4cfec440
MD5 77b1854e6b130f195fb854921406f34a
BLAKE2b-256 a21ff3a732d014a04ed7cbd1be07c047dfcc383a7b40aa10d26dac67a5230110

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db7093608e26053a8c6ac60a0f3cce917b57083857133d58b7a795b3e32e7347
MD5 19e2469fc88bd7eac93cd7df06e6836b
BLAKE2b-256 11c25c663c91b8855f607746590e864ae7adfd031f50ee7d99c0fa90b68fadf5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 13cadcab98372741b50d260255a82f4db5988faf452ee56835f3a1125927520b
MD5 ebfb409b53cc3a3672ba0e8091d69a28
BLAKE2b-256 c997822704d828c94ab947bbf6e9ea505708faa906eb576692d15921fd25d550

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4252aa55cd9213631b5376e8d9f2f95f566e7f79eb8bb12c56e05df07178e08a
MD5 f4094fe96503bb3c6115d7863aa87ecb
BLAKE2b-256 2f89e834393bd69fbaac596d7fd9dd9c7c10c2618f1e0e0438e5dc5c9487f2d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 45daebc5b132d992f3142f2a4678f68d425fe7ffd94f200ebd68722a7ae2e2ee
MD5 bb68a8166e32e511aa328542f6741a3b
BLAKE2b-256 6a66b0542fb00c2daf3135d6b3e19ce6a2718c0c69e343024734c20434d54122

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8813b2bc5b0f984aebed0f1c3ee2e7ffc817e33879e8995f2349fafa742fd6d3
MD5 d6e21e41e17757f7c63df3d7958a1551
BLAKE2b-256 66d3686ff094ed9e36a8559315bb21fbf6f4e26610674350ba6f391f64a698e9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fba89c2c0dd74cf2bc3d6f5048af1d14b03e8d3f62fa576ee2a00ab118b1af17
MD5 2344f6bb5705e21691bfd2ecb876ef7d
BLAKE2b-256 1dfed89c724c593f524744605d4c1169ada89271858b4bbc9ba8e51d53a92bfd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 62a176ec21d1dea0aba13658326e702b70f1b6f1976f82c9a4cd79f2480b9727
MD5 4c5f43d7151c89b41d05db4bb465e3eb
BLAKE2b-256 6bcc3e4413e01cd6de7787746a7ad3503744f0285f807be8ada0775bb68a152f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5201fafe427f23d6d505157b5d1a277e2673a368f9d058f275e0045de8ca313a
MD5 756732a33f79a9f8b940f63a3089af9f
BLAKE2b-256 bf3c6e3e2f6c9e06ead7ba875247393ff24c02dc5f4016d91c8f0e5c5eabb089

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 555681cb5c634edcfd1640e33334122724814b54db340024eac9796ea2de39b8
MD5 642c1a1f9e848658a6da59fda7ab79c3
BLAKE2b-256 7cd565b4286f5a9367c43cce3639fe631f15f9d81e58b284e7ecfec7c1406447

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3ef26b5b42658ab733daca0a42f4f07e4d7b5058f29055c8fa74f6ac2a819da4
MD5 a992977c4a76ffa12b33b6e4ac18de9e
BLAKE2b-256 12c802feee3d5621a5cc9d5409e55fcda8f4321204932deff4c9402b71033790

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8676db2a37821f3d295c44f0b2647785fda06b5ef602b72abd3ccf768c183827
MD5 39fc50509b4b03000c917118285f6976
BLAKE2b-256 4c76ecb8b590e423efb9961558925f79644adf560afdf51dfa81dc00d9f919ff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dbec9abe89339025a0ebe185e5271ec67a34eef604f849a0ef9d8d14284497f2
MD5 07c2c6029e175f80f78f9c4af8913107
BLAKE2b-256 309a27119c628ac8dbd0c2055336a2de499badf9d6244f9820eb8c9a3b921c68

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c2cb1fc09ae9e970fa452c73d5e6553fde4805976c5ef81847e46e8fb58a5c3b
MD5 85c9121d2cb6d2968146c5dfa6514fee
BLAKE2b-256 b6895c773527b42d839255f6f2012c99a203cd2a1c30abd8243b6bbc05aed127

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a76caaf91bcdcffcd9da992daf55c4a89e646dde1f6244ad5eb8f56231e4e4c1
MD5 f026fa9ab187ec789ae1cfbd4e8bf6af
BLAKE2b-256 09a020922a065ff5d24f7313c66d7eca8be2f6f39d6e24df5069b85ae4ed5368

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 af9a165a953a415c7525e3f18bb5da2df6c14a994025047bc50ff5d7c4b4fc09
MD5 65881aadf5e65ec24ed1443ac431e61b
BLAKE2b-256 2132bc0cab24446724559c5cee57d410f3ef64c6049b7e026b4607dc45290654

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 531e4efa00661cb0e52e51fe702174d67c1c08f3074ad09eedf9c7b5b6bc2251
MD5 53f8bd488dcb104cb63548c783db351a
BLAKE2b-256 ff2bd4445e500a60775063e6ea6b8b50da8ef9a80201e42efb38f973b24a7496

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402101701813464-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d745a714dabac65329cbf5dd26bb09ec5d2b543a0baca0735adc15909be3a62a
MD5 70f0809ae9655a67760114bbdb41a726
BLAKE2b-256 56d860619eae7c0d60395f1050b6a09bc1a75d4d51bc7ccc6c2a2c22a5e1a6b0

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