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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409191723794729-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.dev202409191723794729-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.dev202409191723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409191723794729-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.dev202409191723794729-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.dev202409191723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409191723794729-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.dev202409191723794729-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.dev202409191723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409191723794729-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.dev202409191723794729-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.dev202409191723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 58d13dcdd42dcd126827488601523598c2d1f62cf4b15655fefa2de9a30d7b93
MD5 96fc9e1d09cbb2365ccecaf646aaa662
BLAKE2b-256 9b2af38db801390261b5c182b63805ae14911711cff337b773515d63f5faadca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99cd3700ae9da947587b61bc89292f8ad9ca3d6ea0bd5316b671f521e702010d
MD5 da0d4dff9d668b6f7de60a9b23090db1
BLAKE2b-256 41dcb3b4392cdf17626fd7a590d0337790ace4b71ba0233ddcef19b4539dc01d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2df9c399d85f94da9c5d1f0d6c51d139a7169bc860322f42b253f9cdc7db31b5
MD5 39787eaaa0e71f7b2704e2bfc94f9a20
BLAKE2b-256 6ea69a2d9c41d998ed93e243587269cea4b5413c08225141f803880423fa4a37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 643ae780e098bf1e69cf1dba122c307082ba53930cc252164932cdbca61da163
MD5 b55c84ec15bce3602232bc5434c26d90
BLAKE2b-256 7189a507fdd351a562e312def083b9dc4d3862a1ac2939c145089539eaed88a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6e91c6eebc8bf6c35dc4abc46b94ca225e04a70339a05471a48c0f1bcfe76cf4
MD5 52c46ec651edfbd138ccded8aacab6e4
BLAKE2b-256 0f372304e5e840926b0f361cd68e010c13a4e6c10ddd962eceed7b244f39bbf8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 200f1eb1f6c167551766279de623ae1d0c1657e41e1b5ab5e0d87c06e9f0c77c
MD5 a8b9acc894236d56be21e9e4c5ecb73c
BLAKE2b-256 f3b5172cbf86b1e74a4c5e1446b96db9aca3a147290b90a1bd48c6522709f962

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08d9fd56171275fe6f644a3886fb0418ccba9e2a43d1b9b236dea5c3a3c0d5f6
MD5 c65eadccc232d1c873165f0d3fe8cf6b
BLAKE2b-256 87b0756abb2e4bad3cee86bac6946ba76ae29377877c112376a1eea18ef4f8a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e42522e859629580ce3aed44d3843cf47c38417b6ce56fd288a211d988aae1fb
MD5 7c0d82e5cf57eecabb2cce4ef89bfed3
BLAKE2b-256 0f2dd2386d96d570cd2635e2ac80490146ab2572efa58f58a6da53401e3b95da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ffd57c3efabae7fd180f4926f62f9a6e7e0b733128ddf1362ba55a099e61d53
MD5 b0725f4199e61df74f1a320d25ca91e6
BLAKE2b-256 372133bb3aa2f144bb25f6c33433a5c8ef711b77f8e0dd9d77d2f5ef238ed1d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e017b29f515980e378e2109fddb14e839feecd24f2262c558da556b3a50af1ec
MD5 7ad2e4db90109ef39ed2c024d009c093
BLAKE2b-256 e9887be879d6439d7cceda823fac1ba235ff8aa5d4d3c7d33eaaac1d1aaaaf22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 715d66824351bdefc73fd5d661542bdf0c9c2b367a1859095c9b20757ccc4be9
MD5 0da3d888b0f701de105c19850d693965
BLAKE2b-256 7cbff2fda3fe91fa2eb0c1f7c52ef8c95a5e24c73df64a85025415ecb9e00f25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 175ee65465099a9134086022d32bb5ee1ac565e76d010b8d4d5653600666b124
MD5 54087075bfe034f2bc2d1d8b7db149aa
BLAKE2b-256 9188107a989bc8412f94f6f4b4b96eba639de99b0dc115bcee1c140236334c6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6447488d6b78fd493906e82d1fda21428f5bea2d421c2dc20687fd7e26c1b19d
MD5 036ccf38526336b2c0ef58e67708476a
BLAKE2b-256 9914fb06c96d2c9f5e7cea3134ede9cbc92d2f41b91355e459abe93002f59fb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8914500d21ca0562f6410d96e4fa40979907632004c66b6cd1884d6999ac7aae
MD5 8f77be610bf3dffbefdf8da8d41dc5fd
BLAKE2b-256 94ac42c3fa80ec66ec8ef5362f4e5fcea2dee3896272ad23d41ed7798ea534bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a84dcfe45bb6e37591ce3b9c843f9c3221bc37a2daebd9c00bc698851d5694fa
MD5 35832a8a0eb49ca4fef00cd62c4783dc
BLAKE2b-256 1eba675cd2b59650fb603e9a4cbbb3f3827e2e4e251fd6628394755152ffcf22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1b7c7a7593d164efd26a1a5d0876b864704038d77d374d2403a02134b547035a
MD5 160c12a24bafdf375eca30f1327814a7
BLAKE2b-256 873e18685451e11f9c06687a69242dad68f37882b194fb460127412e3d0febf2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5402c7059b3895b543a65b635d15758837a5450ac439d6944bb3a03af9b0f712
MD5 048435004ee49a0b2c7f60f9c37d4507
BLAKE2b-256 bccfd975330aba3e9e2fa85019dd8e8a8588782549ac8628ad7353bceb2a9ed9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3b96399635561aa164beceb716fcb7e21766203df157697ee7189d389c9fde38
MD5 c2901f55ba94b5217d59d0347cad536c
BLAKE2b-256 dd3c9aa31972e1f713289b53c0526abdd7c64b5c126a07c2d53298f7b52d9946

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 168e6ba04d89035e5b8f20849a5d867ab8457afa5fb2284968fecf95a58b0aa3
MD5 ebf4f81f5046d73db8a53d8e2b100bc3
BLAKE2b-256 332cb04e886b331f6c52d1a1d476f394404c9df3fdadd8f7b8591b93704b981c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409191723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 939ac8bc1b84898c124134b5851bb21d7c0d28e98e9c5b0d49ec98833971ac31
MD5 ad1ae90544123842fd044b1c47ac45b5
BLAKE2b-256 e79619e18e1279e62619d4dc042d14e8e9cd7457983f8372126db36774661389

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