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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202406291719384100-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.1.9.dev202406291719384100-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202406291719384100-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.1.9.dev202406291719384100-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202406291719384100-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.1.9.dev202406291719384100-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202406291719384100-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.1.9.dev202406291719384100-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 667f0fca4b4a86a58c58644cf5ae92cc67466f6370a15830a3eed529db731c16
MD5 a15453b3272e562125ad1c889dc57b73
BLAKE2b-256 883121845ab359d79e630c7b8dfce69463af4e5d0d9292053cc4be8e3f1d95c7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d8e0e788669e5be792a9c6ed36ba23ea309de9ea7bfbde815f2f35e145f51939
MD5 f0469000b9589595f8349c0aaf05699a
BLAKE2b-256 9cf3bae357c6f532651fe9372be7c0b1a461517b3d85dd69bb6df235a6356ac7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 62d399c6d074474450cd1b032691bb68616722e90db239c3de94c61167f25924
MD5 e28d0a723ac3c4a0d02fd8dfa0ac3e6d
BLAKE2b-256 a38b98061d59fda87e50f93187651ba14e9874fcd928a5f8f00c184e41e996ad

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 134505292171845bce8a50462c2cb987ddb865c42340d044b649fa56c58faf60
MD5 1872d23e28e9b49bb02122e52face747
BLAKE2b-256 6b51cb78c8d590d40ded0b9aec8bb9043689f4349686103d84b771f652bb2f90

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d292108a50a854e25e5e1064d95be36f35afda0503c4372ddc5fdf5db62b661c
MD5 d363cf2122779837f80832a1e44a962a
BLAKE2b-256 8f2a098c1fe3a7cc959aaa2168c2f96796c8adb11bb67e63beaa7a46f90bf531

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0078203d57d896d93be2f88eb5822a6f3d5c94a68ec317e4827dfa4b369d8b1f
MD5 c89db62c99035783416dbb2d23e0f823
BLAKE2b-256 caf7347de518d7e0d42e17a5ff43be1069e2c962cd868895d66f2832f3e5d61e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4479086186ec52bf8860a1c8d42b88fc3155194cd37da99de5de8af7fd85903d
MD5 98ede35e08185ba6dbd9238e702cab6c
BLAKE2b-256 eeee090726e751b556dd9e4b682b908f0bd33876f55cbd41e50d69420fc24117

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9b08c470d1bc8421baf73470fa7c067afd5d83dbf82820018c4a93112d2636bf
MD5 3c8be99486adc248ae3617c15a50e9f9
BLAKE2b-256 be5dba5c043b95fb226b7dab4b8f0da9285d8f98bd1c6f9bb889ef07f0997619

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 13b370efa8cbe3e1723b166a5028dfae5408934813d45fb3c91d9388876677e0
MD5 706037e17eabea265554ec45ee0f91bc
BLAKE2b-256 e57bf6d095dcef09062769db7cbec7e4ffb3ba51c8d079d6ea885f50032fa756

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 970630719efe8edacf27383c395f584739440e306c08f27d5630fd770f641ef5
MD5 fb997df1ef8c376d6d1365cc7569d246
BLAKE2b-256 fe08231e858f8b20348a6553e82749e1f4ecaf8899df9b0c1861f9ea2ee46154

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1f29185f4368a5f17bd815f288d85d2e881e66f6fc30f4d9d0e0f80443142914
MD5 56e034664702fdf03061467e604868b2
BLAKE2b-256 55ef4bf87076b56831d27a409a2bb95be286920c217de2e30bf11de992550bc3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 51296b978e0bac9d53804c9f67975b2fc4a9d94b18773cebb91527f2963edbc6
MD5 1b25c3c1dd96e4740b35fe8265b1ac83
BLAKE2b-256 13d10c1a37e572e0d7ea03c662f8c8fb3398fdcfe0e21e64d97e8d2a0238f4ed

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4e12cfc830a3f641c318388baef1a24ecb3c3f4839a1d3449a2fed2efc018b4d
MD5 f4fca5301769d776ea3af641c5445a17
BLAKE2b-256 6043ba4a6164ecb1e72fe0c8e94ee4e297d2a2ae4782830a0ef113cc636a47c8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 559f321c85c13c45202a5832bc416d51e2492e6c88341f0ac4ae98b0851c0a7e
MD5 cbc2e06fd7bb3e4d4f4aaa822a4b27f7
BLAKE2b-256 6ee3d96c60ff7207bda87edf8ddb2d87bf5c035862e0c0b8d1c879cd92951f37

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6c7cb2c582cc5af212a82c3e8bc08c0b7bdcc560cceee5fbc1a28e6559d5aba1
MD5 ff8b774a0374e046eccbd531384f9e27
BLAKE2b-256 81731f323d0e89eac6aab5229535b55458bc908ad727e18102273d3d24cdcfe3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 25ac929b33b6ce1009cbaf4d92eee80e026868762b2e738d84c48d9387e19268
MD5 1fc973ce6ab3bdaab29663a8e6a415c7
BLAKE2b-256 04a9532a9ec68d28b79cb445df570994d05546806a9a8d34d8238e2b26977a6c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9fc8eae3bdc3b3ebbce1d0c5b87030832b71d8ce8b1b9dd44ad2561a097008b4
MD5 61b801aa27a91b6ba913b915146e54de
BLAKE2b-256 3092ae766c7ff3deabc29500124920e575401011d24826eeeacc68ac588ae741

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 06e019f269c1557c01411701a1db4af3bda7b9c51db4b6669df1dc8741d6f4af
MD5 75d61505f3680568e3c39b01f5c999dc
BLAKE2b-256 ae63367219f527b6778eeb163708743ca74235f83a75803984c735cdf2d7441f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 358387de2708263663644aff32e8cae945f43c0b40e664241402e62e6344dd0b
MD5 3c992e18ecd7aa95d0565878e2b5e48c
BLAKE2b-256 97ed63a945be2837d6a6df9614a4b8c03f273eaddd590bb43e9d8e0d35bf2aa9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202406291719384100-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b821adab713aac610768dad29eafb05d1e91fd5a89e5a38ff095cd62e4107d21
MD5 f2d542a2bfec4f3ab1cd7ab780ad2669
BLAKE2b-256 f02b972636a56e1bf6e039db5a43b4d47c161deab0ff07f94a8b870eef6398fb

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