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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406191718113029-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.14.0.9.dev202406191718113029-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406191718113029-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.14.0.9.dev202406191718113029-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406191718113029-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.14.0.9.dev202406191718113029-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406191718113029-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.14.0.9.dev202406191718113029-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7f811431d8ac5d2779152eb65b24ab71135ed53ec1370a47fa6637e06d2cdcd2
MD5 fc50762caea2abfb3eaa3899ab1d0b14
BLAKE2b-256 8b7c0d31fc6fba4f7f2eec3917237de8d65b4841f58fbab0c286cc729c04d3f6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e8c61b20639b321de19924bb2b1c4c3e84346b89d56ffde78b3cb3e5a02f05e
MD5 48a3336a2d87376c8e5d5211826f4f79
BLAKE2b-256 38ef5eacb754d68c68b2a8398f6ea484ea9d952964bfb3539b472458e505676b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a85928a1db6ccc6fba6386a9319f6a619db4f82424b70c050ea07c769c27b19e
MD5 39ab7d62def9776ca46d6054f7a48b98
BLAKE2b-256 bcddac7def093d0bf29d28829813aac63c126596fa776c4c2b590606f3d807fa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4154f857e18c415be0113cb3087dc9cab306e5f2dd1a4291996263e6558ed8b
MD5 17bb92237c8a36ed05a96af8a742483e
BLAKE2b-256 fe5ff3c882d69baca1083a5cc4c11b7df27a1305e493e8397b0d7adcc713c756

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 239afda356fd7fad0724cd5362f14680052f821c49e2a4676e202c454919cdb7
MD5 5574a9adbee8941fcbbd7d9fa983bcf5
BLAKE2b-256 2d93989176de9f93a34f8211f5766a9b4b8fd67351e76c34b95907ddf4284ac2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5be4ba94dcd090af460e71b6f567a036be106fde61e8548ca6b2b648f5e399b5
MD5 27b4d3d2c284bb6790476f80e58f2758
BLAKE2b-256 40008b78a8bf29322a9c3bd53df0ba132ad5391a6c7593851a2935116c6b5912

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 41c2fd19035782ed1c4904665aad28743b26e7412e643580204b0f79b6c5537c
MD5 90813969cadf3ead609647d3e79243b1
BLAKE2b-256 70452a6cc148dfbebc3cb7ca340b08858024d205b2db897cede8ff1e4725b57d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 20d1499c3d441a938e09812262d0fa666fc9dfbab7d8eab4561896751c7b0467
MD5 4d1ef7acc54b55f84cd36b4e191f7f41
BLAKE2b-256 b71680e0a24cd827bf8b0e5aa38a54937b218da12b23ac5570b60e0b9c2b9497

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 636cf12ad6a5b8dffa580ce71bf0db6733d6d85f081aeb578842cbf80ec32c7c
MD5 21784935e7d52c6861e14a3133a7676c
BLAKE2b-256 475e271ad3e0abb1778b814c42adf8cc8fbaf5a780cf12396bcd54ce15e1d6da

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dd780acbf00e84453e7eec8d782f266d7e81bf53b442e28afa849516ea517ebd
MD5 0630efe9fca92d00ef91340160f696f3
BLAKE2b-256 8b1cc18d77e7a51bb24e0d16423fb36ae2d8baa66dcc3c71b90db708838a18fa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3c98906987f4f14c13f64dd7ccd265562848ac4cb0dca0f9032a87b350917589
MD5 e6e849dddce606c1f5b3ce6efadd9c8b
BLAKE2b-256 a330ba2be5bb67d0aed8677c4780c131bd72ede6768045ecc9c0f31b31f7ab11

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c18112416b9cdf983f3c9bb541a635dcf546389a9d73e862815e2d1d16b0f9fe
MD5 e3284e7490feea5fce4c53f5c806dfc4
BLAKE2b-256 9dc62d446214f4074bbe35ec08b733f6d4566edaae56d381b036773d402e1143

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2b5b5e4b3c80deaf02072015957c35c7104cf651139e1c5054f871e20effd908
MD5 752a3f52229f40082f74f8cf126bbbb0
BLAKE2b-256 86b8f58e9fb58041be29c4b4a85e2f155d8fdf32684a85a5f2722799b483886c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c0b503485c8b1ff0a33d00cc2a38bd62f46b47a420d1f0f089b506f51d3b0e36
MD5 a39b2c561a032baeabdb5bc10cbf4c11
BLAKE2b-256 265e81755083ef5629352074b96f65dbd26d694daf2b1b036f9f4dd539cad1cf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1975f644bb1b3b7ca6bf65b262672a3b8d1b9716a7e62569448ca68ab7076c10
MD5 02f05a0b962bd70e2368ad57fb3d22dd
BLAKE2b-256 3eca8aa1ca4a424532197a7ac20a4582eab25e12393d342b08a90968418269fe

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d7189998a7a892d70f85fc745447fad7af99625eec5441ec985748c9ee4981d8
MD5 f30b5d5ba6d29faf13f1d81d4825d030
BLAKE2b-256 f380d3118a3ce4f4a328da3294f35fae7080fbf4ab03bfe21ae0db8af2214ffa

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 333c4dfb5d24990bf417b820dbcc9826d764605620336e5593b2c042dfe9ea47
MD5 9c8d55b1933be68a07f53b835c7d6db3
BLAKE2b-256 595283c147ca9a4a5542122a2201e759903c3b5e16cbbe6a31ae0d80bf06a923

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e8eba0bd79f723f096d808ea982e0859457835c4f71fa4f70ef82c3b55fb9d86
MD5 2e1c1d34de6df0c6cc06f2123b9f804b
BLAKE2b-256 2a49a32e023ee8c906bcf0ee133a59a685b27e80db07299535ca4daea89151b1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0ac173d5dd390d27559ce539e5f9a293b58690759539a725e8bf9fdb73416a8c
MD5 4e60f6e3d06ace0ebc0855b770c524c7
BLAKE2b-256 a34714bad255cb19ebf35d449299f049750b955ed10e708f16fc047716dd980f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406191718113029-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 50fc13c0e104752690ba11974fe61f7cae6cd44d7ea4ebd67158d94b16afa27d
MD5 7ad35731b38396cb4950b3cb48747ab3
BLAKE2b-256 4da04501535bafc0ed16ebcf1eddcb4cee8ec74f9b08e69b3db3cbdb898d6965

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