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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409111723794729-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.15.1.9.dev202409111723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e835379410c33a84455a3498ef17a545dc6111d9c257c261633a99c9c4cd969a
MD5 a039622e439bd69e9ec122cabc0f6ed1
BLAKE2b-256 5515073869d7bc60e90716f08338b5af8baba8b968a5a9bac890afcbb6388f83

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0b50abc75b9a286f57f852fcb99feb7fcb3950160a4117e05f0bf062839281f3
MD5 a9d79044e2be063f5b91c7762c6c6414
BLAKE2b-256 8d8d2aa687defd86db615f9b450a1ea391eab75ae44d409b152a07f6c88e7cf4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0b1869b960e85c229b3df2537cd1c47712861d11ac76e2c957fd3124aac6e413
MD5 215154db9a768ee3505f716052e048e4
BLAKE2b-256 eb02c117a5bf8a3ba610360c5cb7797ff90c107e396e03d9e41b45d5f593f364

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa62c61d0efa845b7c4e7f3aba791cc6c67e8c63a28cde41c91cd811d7ce9ac5
MD5 c4246d804b293d61defcd8932b6a6f36
BLAKE2b-256 285d126762f0c04aa7296d8a2328733810f809a5c8483e5231970e11c0b15734

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8960f4cc0b2fabb0267afe5b5835c0bc42576a780679721a408202b9fea02245
MD5 9b6d0cd5d6d42d530affa2096c3a9429
BLAKE2b-256 b754088a1dd0fa3f99b77ce2bec5db312efcb6a7badfdbddfe444678f7421dc7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e817bcc8a5ff85b0eb122e9e6f0c31e1e3ed653aa9de619c8c840206e0041862
MD5 26c9c7cba5ea236185b99a9e9d98483b
BLAKE2b-256 be41158c604ba1c5d5537bd61a5203338582d03a906b8035c542b677cff84264

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c89fa59c7b85d7f6ffcbf719e305d22dc6af93474ab307d58c4b5305629d184
MD5 036520cba1618ede6f04c491dc3167b3
BLAKE2b-256 9e2fd5673877827014ae19b162016740c9db4457f4e319f5060d78022da277b4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 aa74e3be4a8f17666c712ea4f66dd21458e01808e3293cbff4e2f54b3e571293
MD5 da34fed58fb31055b6f868be328bf9b6
BLAKE2b-256 54008a996d78af8084b9e2018ec25c35849c0fb878df7f2887347afd9212e563

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8289803400cdbdc968d164834bd2a3bda1b553481afdcf74f3400679c03dde1d
MD5 cbd4dd2c8fa996da302799723b893395
BLAKE2b-256 5c6d0478760be7b22460e69972590ff3d1d8dca9e0ba97b9caa149f261b0be87

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 da1428ddc7aa78186ec04cd0637eadedd800f2b9bc3fdc268befb2ad9b18d50b
MD5 1fc99d26fab4dc570e7401c1390184ee
BLAKE2b-256 79c48f299fc5d11fa5589072a1691f62ecf298b7fa437e8599186a0f31b083f2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 393cc60269b2944b25782abbeeae4192d417c0c649bf95aa08f098c72ec0c582
MD5 e9589ed3de32bc76cde9c930a08b6a3a
BLAKE2b-256 8e847c14b1ed47fe4f0012beab336d3ced0a9e0701dac121a4c572474d3586bb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1ff192c2c2fa0177b2478e145fa7b33e42d7de3f329a962e73fcf5d217d8c4d
MD5 7dd4b30f117116e11504e733f3c11e65
BLAKE2b-256 fdae0f5a903eb8c0e0e37be439a1f4c037bf842c11daf0f862c5a74ec2c613a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bcdf6486577a038574524e4000ab9f7f72a35f40659c2da014f1b3444f07ba0d
MD5 2721987e5712e5cb47582ca402a89754
BLAKE2b-256 ebcc994002e1ffa1a48ac544c49fa6a5af9d9b7854c42bdcd3440d7d312b5d98

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c1bb223e24fcb454b7f17de11fb01302091f024a78b497ab4b8b01cb524ff113
MD5 b1cf96aca3435474c3ab22c81c3c179e
BLAKE2b-256 cb680ea3f36ab6238493e32849191b751f1b556a9f93eab7387a279766c2a557

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5164b480c4e05f3d0707e09d928257d649053ff4ad71b813bd5fe7c95ad1e33d
MD5 0bdc3ed3d71413e42d39c61f9948ae7f
BLAKE2b-256 61d1ce0951559e29c4019c3e67247e190df101797a8e7e965fd9ffd01639887d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e7a3e551593c4829e593272815bb736560e972edbc996092699a735fc93e8996
MD5 8989495abf542c8540b9715a268c2297
BLAKE2b-256 b7683284cba468d3f83f69fbf21013379845816e5deda0c456af89f7ff581aab

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d783deaabcf9e042d5810200aabefc37bc2a3295432bab89e413b9a68056f4b
MD5 3514eb945fcfadd6f107d86a9dd0a057
BLAKE2b-256 9bc1a844630e7e33b71bcb9d2f805efa7d9f0ed31f977cfa97fc8900197fd1e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c8c62364942bec7087197056447619009389c6d8bf03b66bbb1b52a1f804e908
MD5 73e247e0301b96a2459e5d27299b60af
BLAKE2b-256 fd5a3e4afe91e5b5b24cf61f1d3e26c87efcc3d4df39c9dfb5a0d60a22845ea8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3fc17e5dac023aea913e8ab65b6af1150c2557aba05c88ef3d6d27a7cee0a204
MD5 906d82b1b52993e1835b38e992cc9929
BLAKE2b-256 99dd5cc8dc62a22743a9178ff12c4e39c58d6ee3051012617c6feadfcc38a6b5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409111723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3758149c4d373560679870cf53db13b9c39e488f9f028f16e41dc3af3538ef4f
MD5 5e841f13fef08b45ca6a240c0e8f7f98
BLAKE2b-256 cfe1aaae8dbe9cddb4ca9f500ea0f617b5555caef4ccf4288fb1eea12f370fe9

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