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

If you're not sure about the file name format, learn more about wheel file names.

pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a20adda01754377f6b1e450b613cd7a44be977036934da4642dc6f863ffb06df
MD5 23c2ccee9d6d7f9bd2a8a3952fc9089a
BLAKE2b-256 27fdce8e12a271f6ae6fb37d444a41582b480fb5f1e090c297ac9808181fe28b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 41add92443cc565aa1de28de2d39ede2fd0a8ba0baf8df26ed82e32205f391dc
MD5 ab7a0635661ee9b86daaad9f5587d392
BLAKE2b-256 2620a2d30560770c66d7d7f7a548a1b086378f4747cd6cf2e4bb4cb5b0d6cfa7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e5124510a6a70932f7d3d5de723c08515d8f7a8f9b748baa99ddb5a2b92e74d9
MD5 b6e9c43683bea7ab473e1641f5ff992f
BLAKE2b-256 970f5f164ad9e3152f2e548c962af29e587ca0759488e56d50427d2d469f93a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4116ee4a9e6b49e470103f17b6468bede0a320a05e231ab7774c2b8a6951a4d1
MD5 6ad4f749aaebe535a655056418b5591e
BLAKE2b-256 69221e25ff725dfedb3a99b12950bc42b4e612607e460e057ee7b58230ab274f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 97ec1fb7c42749229be4c37d45892f2e3c9aeaec168fa7b0d50052d0ff373470
MD5 65d8d5b975b98884140a8e403713edec
BLAKE2b-256 90efb43eedd6f34b3b2848fb8010e81437790b069687bcb0b7421a9833e0492d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 347a337e63bc39a9dca43440e5862fa68c736f8dc505eda797142ed4039663f3
MD5 b505f82097f77f7f8af8252e3bfcfdde
BLAKE2b-256 4832962d30ebdbb3958bbaafcbbd24057abe90db44655bffa724c197a7b37f0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf18256b8f184a4a843450a4cd9a61efae71a61d32bfc49e6d21af4e35d44f90
MD5 a0a14e852b80fef5d57882b62a834a5e
BLAKE2b-256 647622e1fcaf3a498c9c179f56fce354dc94e612d410ba1177bfe25ab4ad817e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0b160bca9fa140045f6dd77c8e09da5c403c4d4ae88a26adaf55869c71304624
MD5 3b9d640324b8a9cd20326f3addef2b1f
BLAKE2b-256 c7815d981370332c43552855586cb9144dbcea8f8468eedd5548395587b41094

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d4d20b798c838d4a25f16ad0220fc6af12d442de74d3a3f1725455c303d1b975
MD5 ebac180a822a1c9a316c4d2c6c2f5cfe
BLAKE2b-256 bde85b5283cbe3f96fa12b39f4d19db0789d57007549c0ea2f81c493b8259fa2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0807610bc36025922421f6bc74b444dfc8aa7e3ab0e7f521f54b24304d5e784a
MD5 caf8abec8314ad56cd9f6ef58ff400c8
BLAKE2b-256 46dda79dc64f5d39a2521b2ec30c9a0f68408ef2e6805e3b05f59b4f9da5f2ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0f6f0a4a37dc17f3d50b48706081dc04c97b8b90e0a17fbbcbb8f30d1ad6c19d
MD5 7d0033f2b0b4f5b3b79a367a9253ae7d
BLAKE2b-256 e790e67d90f81b87663e9c5a09a423e72e60e234373ddc9a1067aca35d8965fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 77c1f4e65dfde1c64c289fb7c619e3bca3e49ffe7ff0905664a87f93ad5e05f4
MD5 666b9d6acc419ccfaae054b84969da4c
BLAKE2b-256 9b3639cbe108a7064903a3e78c4d250b83821bbfa4640e1939f77b70e3eddb40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2b000356c5c93fdf3d081cc86ab6ccea2687239b72e26e6b0709176e5841ca8c
MD5 9e2a5beaab0b297b19e8b63f51add118
BLAKE2b-256 286ea9f9833f0a5fd8c744c5c7dbb22f929946da550fa1e63b366bb9827f400a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a01e9b1eae8171f329122473cf160c9a3fd63d0d2cbfe8d6a8d4476d6bd05f46
MD5 476d4a0df1718274969e3e462c84050d
BLAKE2b-256 074ed998f495ec659d439410a82645f31c5e7c04dea939c1678a30d613f49e7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 95b311a026518ab68ed497322388d3cbcefaa9145168ba96210518325fa22ead
MD5 2e9fd4a31f956b95400c5f0c0e3fac6f
BLAKE2b-256 e24c9eedf0152a717d4a4c79f375cfeee756f3d7467dd15a68e1877ea2971dec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0027d9c9d21751f3f1277759b86a4325bdd3f4c188b93adceb9a0bd58cb4689e
MD5 2f0f21d7fe66488feba5fa96e0eb036f
BLAKE2b-256 4f314dcdbcf66ce72a78aaffdbf3e51b48ebcb803f9884fefcc12547f94eb5dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fa3673f903233808e99682a23f90f8468f8c33bdb1b8c3a36fd9f41e880a559b
MD5 7c25358a0f23419a37b29741e1933216
BLAKE2b-256 10e94697459a9154230841dca1d724a9be05136a79f6ae1c726226b1bf2ee789

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5c9d24ff8d120a16d281ff05c96d317f9959d08054abbcd8ce6172ed4336ec86
MD5 1ad9013be143c4f3adcdb4fd517b33c3
BLAKE2b-256 e44ac1c381254744445f9bc82968626d9111a55ebad0545e52a67048436751df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 011d9a9412e8f4ce79997551e84809f0ab8d6d4f07d9afb3eb59ddf9654b2ca2
MD5 e1d1ace33dd66b7ff1bf0815c74ff2a6
BLAKE2b-256 d3fe65ff9ed6afdcb9824e08d907fdc018b91f1f38c6774fe96ebc30ed2915e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406151718113029-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9ffeae5506aaeb8caf6227ff44f3f38724247c83d9e7d34df3ab7a758bdd0e0b
MD5 38fa378e0f931803b2800ac36905f2ec
BLAKE2b-256 44fdab20e8e2a93c38a3eede6b444d338bb8ec925fd6ca5bde52d3114a64283b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page