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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407251721169663-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.0.9.dev202407251721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407251721169663-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.0.9.dev202407251721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407251721169663-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.0.9.dev202407251721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407251721169663-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.0.9.dev202407251721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d1a29c36b2c6e3fe99a6b4aad11ed5d48434cea4e06dc7c621f3aab31605020c
MD5 2d3aefb1f4f43c9522f3a25e1c694cf6
BLAKE2b-256 a4b3c899486db250cb2577eb29f1503c773c6e062b4257ae1e9fe24550e841cb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57f8daec1ec73e61bc64c17217ea64eece3ca6f817e2fc77ca4d8ed6e28e7bb3
MD5 c7430638b2b4a92a2d324602358b137c
BLAKE2b-256 796c240ac48bc64d46806c35fa47a1ef47d85e58a1e73798adce84bf1ebccb53

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8dd6a56b367b6c31b9dc93287bc8b65f01be0162af0256e2099fc6217002a9bf
MD5 811824afaddc46f461b41b6855003867
BLAKE2b-256 0b038e675a513136d9c9bde434414d491e23be26b3b733a35d96dd1417fca8d0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8e40107ddbbb94a40402d845c040fe8fde8d0fbb6e84f1a799976823a981d58d
MD5 d66bdf85a6721385b1d768d3da911d14
BLAKE2b-256 9b28e3bc45c66e7262a3cdb86234e39b576b104ecd20f3e41110ad6a3a1233bd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9c41b1548d4e999aa6385f0f0389d321f2ea7091a6c86ffee826bfd546e58a39
MD5 50f4602a0daa2a78bf51ebc701590dfe
BLAKE2b-256 301a47b6fa6166be817024eca3f59f9a7e0e5689c80425f34c07867b0c795fcf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 55d49affc6cd46e429816aee11ad467a22f79f5a0ddd67b06db5c77274e1e4c7
MD5 0798def19d82b4eb903b98e4f70fdaaa
BLAKE2b-256 182065c73f3f50470042c53500dee037742659dee195427838df5fc90ff59879

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b0c2f1558dcdc5b6a1ba1327cc2bcb1a4ca53ff23826186e3c2c44b8bb85c2fe
MD5 ac240f4d7ccb03b5d89479cf40e2b686
BLAKE2b-256 67603469969ff0b376dc42fd5501420514b0e08b8c6efaee69bd5b25a74d3eca

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 512a07c0efa5aa255434ada33d7ce302a82dbb36e57e84f1d23c008df4066e93
MD5 ebe261c11f34939648e65b1ec1d05833
BLAKE2b-256 fcf1a3fc2b326c734518a4b0967e95ee4af27990d5e3b13f891aafe3db221810

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1382cac2522f06126e73c53af0056560c9e9f15e70f11c6a1c0fa0408e386e8
MD5 8029196495394deb508ec61a11bb2b91
BLAKE2b-256 3e27f7439fa4504f1833342c51e7da3fee30bff853311acda3e921d6646db5a3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aae8e664575a980c10afdf8703f4041114c9aa31b51f8b36241c1d721106d8c8
MD5 ae5754fa405cba5218ec84b582642161
BLAKE2b-256 a5723e60e34390f2f5e6f0ceda85a4a0d14c01332f1224d2240d79b673c794a9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4db9b9731ed8230f5fcd141c12d48312231b236cd5e2e70525f0f0933289b2e2
MD5 d12bcd2320bacb0807f4349e94eeeef8
BLAKE2b-256 de4d8c1ba3c825d4dd6e52752d4148b7ca8ceb23b43cdd12660842d9e11c20af

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9809428ea4ef2eb518bb4305fba7635b807545d2c0e16a8a98ce99092a31f296
MD5 1172cf35bd52b20385bc2d748a04aec3
BLAKE2b-256 2a8a6fcbce336def4e5bbaace8312ac107660c41966c284137e0c754b9f0063a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 845b53030695d5edb670204065a92bfcf9e60ad7b6eeecb0a8fc3857967da1a8
MD5 f7f4b2092c4924de7c5f1c16fd70565a
BLAKE2b-256 de91c8c4f7a89b2bb37b673c686a8d3101bc58e7145cfcd8ebf6c48c95b81682

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 494bd303bcdf0fdf1ae07e20cf697a6a9459c411d78d38630ba809e34956a599
MD5 9ce356d2048a038ce7b309a12b51e461
BLAKE2b-256 123c8d1f1582993f5aea7bcc8c413614b0e37574936235f69241578a501dd3f6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 07825f183348b673cabf743078ca5e9d414878a4f0de10da34053a57aa62e5d4
MD5 750f9026da3dc3be89ac5dec5cbc6402
BLAKE2b-256 d994a0e72778e1f798242201ee0b4fd521da454d42454cb8d7b5a54fae478673

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f53b1ef766452aea6cf7118ef4739467260cfef59640f3276833a66e728f1c7f
MD5 3f4e068a0b874418ddf60d8dee8ac83d
BLAKE2b-256 55936fe2d7d0074625ce5dc5eb51ec7dcf0e70479c879c06eaf65be376a1f220

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 26bb35fa5a00106611c7c266e478c0e3f1c12fd5f2bd7ba5ab51011c0fa48a8b
MD5 176a4ae4cd3f95bb577216269d74626d
BLAKE2b-256 ae2d46d45f0940f67cee1875e8e5acf9093fc4d55d6e13e1410c4e279a8f6af9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2f9f773757f268afcacaaee912d498af3cb0806d537d404a6ee45452ca269930
MD5 a0fa513210cfcabaf2f9ab5e0f287fa1
BLAKE2b-256 7e76eb18dcab753a217cbc1c5162bfc9eca8ee48f2e26bdf17a42baf735ce52e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b6e6d9c5a390b12a6dbdcb15fee91224431362d6e3cbac63664c24859059b450
MD5 078b1d7ede3213f1ba9c9adc043af25d
BLAKE2b-256 3c13ada640be65294db4e3c0d924753b12f423b5da817038e26bdefd317e08be

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407251721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4ed96d068f2207674f154118496df2c892efa28d2519c558fe80a12749375315
MD5 ebc0c8b40231861b33ea8b1b4554df23
BLAKE2b-256 09653415cb3fc6f796b22bf0ab29d4964f8a132dfc31c9b9e4b12ba54cfd4855

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