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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 278145a50c62c8ab8debdff57e7abdb46d35de50937d39aad5cfb5405bf25321
MD5 2542331766f35c7c5d53266b6f9c371b
BLAKE2b-256 a509f5319071618f49ec026fd3673fca9433ae7d33431d56e6404085029ecb3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b01cdd3193b7ae2088c23224da04c75d7d8134ddb279cb05529322d155d79bc7
MD5 346d5d8676be262d95f10966b02393e4
BLAKE2b-256 380a67d139f8e4a777b42c5da73b32d53cf89797ae0abbc7d3e47ea74cb4c94d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5ad5ad59bc6a003b08d6443ad88095fa505ee9f9b6db46f9c96a9f09230181ec
MD5 3c7a596cea1ee2e9e33415e79faebea1
BLAKE2b-256 62d53ce23148a409b3dc00169b7beb9b7f96852fb66dd18ff956b625936e0f1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 46b0f9e08e63dde4667184ea36a49871f202ed5e95d729d8f8ec83b4e9f94a9f
MD5 d91bcdd0621e2a7fee66babe80b9246f
BLAKE2b-256 9d35ec62012c0746540c0e0d193195e6b6197a39f293e93047f6200cd7ac08f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d8616fc11a260b833edee9fd311d731a8fab56dbec8b3c12fbddfff230ac5f09
MD5 3e7d58d2bd7279baac405c2c1d2a6ba3
BLAKE2b-256 2feacd4eb18a4c4592ebd9067581d8a3d333b76c6f3016fbd4a86c0ea90e8a80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4b557558f6eed7272f4105663b7625683d958865dfc8a4c8624b81df89d3a41f
MD5 e680f6ce5f42dd9dcb63ff5f01eaf5ec
BLAKE2b-256 0fe135184d9baf0bb04202d6bae958a69135da2d147d36f8013309ff3d470345

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9e285d4e03c1a337fd2c79a4295eeac6c0d015894b750147ad43b410bb025f9a
MD5 05edbff030c762c68099ab7f5fae0f68
BLAKE2b-256 eb043adf5b2b5184dd0a6903ac11d2d05c5bf465655f8658b2214048b2dfeecc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 46845ee498725dc158e46c21ae9d258f00ae6b5424b34e68bfde12db638b9ce7
MD5 e81aec2e7779c31a42a52c97e2e09b26
BLAKE2b-256 20f2dc815642934be1f93417587fbe8d27e4b598aaa98b99fa3b907411767bd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e82fcdc77f29f516491ef84f3b4f0e24e5641a25aa119d13bcd1683b385248a6
MD5 a0c3fca113417ed12a4022a32ba654d3
BLAKE2b-256 ba517f49ced61be6600098b5b5a97b0339441fbadd600ba91abd33457e901c76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dbe9f0735619364eaa6f267937407088db709b2790bdbe29514121e1d2c1f875
MD5 738a50f3d8d0ef7b0c08fedeef0368b6
BLAKE2b-256 7ef11d146726776c731b5f5f24786688bb01307ba6a17b25303368fa37d3538c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 259137e378a1f5713a97d665e6d962c51fb52bb3e868b43e6cf95ffb2280a454
MD5 4532d27dd48202a5f75b832f9573070f
BLAKE2b-256 82ac5647daea370c3bf952f30c4ca96f611a0d0bd18c97815aacf81609709028

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5d1e41b96af4126b2c0de3ee0f44b2ca1d8d14b1a97ed3d953c15fa32ddb93d9
MD5 156b4bd61120747afeaaf4775cdcda7e
BLAKE2b-256 7f4a2d9628a5f134f3319cbf8fb4303e715bf489400aba875f058f1488d4f540

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d18374d6f9768b8a09c3cbf966bba0421fea94e1ff543ea902761d355e14795d
MD5 1212b4bf354485b636c0192749df1e25
BLAKE2b-256 f550ebca521607175610cb4d66937eb8048c74ec7c8793f674422c772315060d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12f200f4aa217c6da09129d7244119abdafd3af99761c8715165f287914dc5fb
MD5 ae1c4db1855d821f7c0d07e858eb2db4
BLAKE2b-256 8a9fadb54a657aca35658b5a419e912fed2fc320cbb8a748078fdcae9e350997

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4272ae23fca287ed3b5a2430b332130aa4a0c20d5e421055763cf7a3763b1dca
MD5 76ccfe798db23fd85571b79534d7203c
BLAKE2b-256 79efb599788a7a6bf654f60556c75a358fcf9ce67df45fc16f8bd1ec0926bf57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5b8c222a529067bba0311638ac269bf71311fcd500c47e5ac1ec17be52ea66d5
MD5 64db4836ec57dec701fec55905bf27e3
BLAKE2b-256 76f8f84e4dc868a7294d9329dd0cc6fe74b69f7b8a273a91765bb7abcf6b8891

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e729e1cf37b1153649effc86e110c04fe74711bc4b277dd4f7b8cd1e574075e0
MD5 f9201532b37e335ad2c3a36346c20f1e
BLAKE2b-256 75de9537cc2e100def321053412b9418c6fd5cda68609d5f5863a1c4467cb430

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d819a85e63ad89665445a6fdec90e8ed43ff60a9b6b7ad926d19abfc120bf160
MD5 299dcc224e524fdae951ae8c59bfb061
BLAKE2b-256 b4966e727f2714d15e5e55cc8a68b42bbef8c3bdf33d2fc998be66f852d40399

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 967562af7a3aa329704bd4dd37773aa9f856f202c737e92757d9018dce2014eb
MD5 573bc36fba0bc465e818bad5cdaf5203
BLAKE2b-256 aa23da526b40a6c46fe9000919c2f873feb2f3e7a2a1cc980f191fe7a684c6ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406171718113029-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 61f2b2eab4bc6b2e3223ed3dca7df2717c574ffca19a6ecc20a125018746f93b
MD5 46f529743eee2b1976b07530cde14498
BLAKE2b-256 a5a6cfb79dad32b8ede2f34288fdcbe116d1d46ebfccbc9d03d24ca526b87238

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