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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.1.dev202406261719262276-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.dev202406261719262276-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.1.dev202406261719262276-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.dev202406261719262276-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.1.dev202406261719262276-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.dev202406261719262276-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.1.dev202406261719262276-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.dev202406261719262276-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.1.dev202406261719262276-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 01b0d6f4993da98183098af29489b62e5e1e3a3a5774cc406e6f4c0b0925549e
MD5 e2a8e53cb4c2b6158a2118f7ce1c1583
BLAKE2b-256 e52ae8bfe3d5fdfbdc099d944a23fb7057e6efc59e904acc0cbd137f9b58f890

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 65b86baf2f0642dce1dd62179994ee0d059c51a15f8be0f57335ef807d8ae7e7
MD5 8932feed03ecb50293e0cffd1aad37fe
BLAKE2b-256 82ff2a57f42a2d6335fe9d7a5ab01d98549368e5ed7517a101176a9617356ac2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 db2cce21c3a76af977a350be54bdc49418cc00fa0bfec8671d8a6c297af404cb
MD5 7b32aa9cf37c820ac981e47321ccb3e2
BLAKE2b-256 ee381002b67d7065e69de09e67a74a9be3f89e6e88b166a38382a5671d2368a9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1876458852b19b7a0dd070ed5021ae94c5850fc42d81113704ad475e722f24ff
MD5 043e2c714f53d270f4fa946936fff43d
BLAKE2b-256 035da2c6a120f6a5ec686177bd3c2e70c7ee8839fd82c3f52b2fab26b21ddbc1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d7c64acb14eb3bfab9fd8e74c95fbf9b35a419f9901e72e5e9b779fcef6212fd
MD5 51e374683cd06265ac7cdd62860609bf
BLAKE2b-256 229024b7357dad13299ee6931357936469e8ec6724480894cc4fb04081a0d767

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6e25f64933f61e55f8beb8653dbe3e895af06e258fa1d53bcff0136dc5e3c0f0
MD5 8e0ae3c609894f8c1151f8ff5a5e7f21
BLAKE2b-256 00fe9f9e4ec705189a606adfb580735f07f9367c2a938bd1ae5c8bff3054646a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 13d839b712ae13823c628133a24130074a22b4721b40970b816619d99da4f3b1
MD5 fe07c474b75ae165e4de75100b57b6d1
BLAKE2b-256 ed01afd4e02ae3821263ce9ee8db6b3a878cbf29df803fe209b2ba682245c62b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b1986978fc8646cd7fd950bd2b562095daab690b41324621254a63c11e85572b
MD5 08475d35afc03dedd8cbfceddbba2075
BLAKE2b-256 5eb73293d52b95a985f4a0e670aa6ed1fcc7fac71eb9a2f7b3c41005c97d19a6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cdb1f36eeb767dcde079314fa172aaa661e4b412298fff009341e9b7ffe815cf
MD5 2ff23bc3a268e429b08d826dab89e04a
BLAKE2b-256 2f7b8aa5863539cba3614580c66b0bdcf58268143e5f7f052f95895555557fb9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 da2537e910cb9e6fe0a7bcf8e198908a754d96b288332cb2216ce304cfab7f69
MD5 806c720a906d036bfe81080636b225b3
BLAKE2b-256 6b34801de5ad3d97bcbcce7af0a2c9743de1403ecb153a6df7fbe3b61d02baa4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b9d03c492a6023756d26182ac7cb9c3d4192fca3f95bd57b2b1be8077c1d2b4b
MD5 66c0072f12e7387d2051f441b9332418
BLAKE2b-256 a134da2e1e258404def3ce59482c323a93f536529acfe6f9769312e557263b90

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3db7988b21b3f77c2a52b84d6c074539aea7b12cc027833372af0e98ae7f4c84
MD5 9760461db005419fe4e42de30cfe4d89
BLAKE2b-256 6539a77b653ca1311147f154db16b1873f9afbf0b9fd187c9cf0cd0bc8d34021

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 894ee59cf08d2938f32e6d08bc7cf4410c0a1a9d1d61d5e8fa8159c69bbb3ab0
MD5 21927a118e682197c2f5cea999e9f670
BLAKE2b-256 43f90d66fa4f33cd1ca4d1822eb758b08ab6bf14367bbfb230d82b0e0865441d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 36d5490a4f999993df4105edac2a7c27638e3e4fea661cb02233d9f99a9959bc
MD5 9c17a3f800fc4498b2126ca26ee19d04
BLAKE2b-256 e0f47f99c6dbbdc2ca7dee2f17d55b9cada377ae7d4145c5d9d9857741bfe8e9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ba3b3ae6938cce953bddddcd3385b376f398fc381e416f5a58109a4dd3e5fea8
MD5 ed20f7979f5d1b5083c673346724b91c
BLAKE2b-256 4d9d0931f33c68cd91e1f8c8f0f92509a2e8b2a583700126767c9ad20b9695cb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 47286011d97bb14a0de8dc116d2731cdb195a5c5460988805310ec2071b4a9fb
MD5 a2b8bdfed83c5b9291814b799cb4494d
BLAKE2b-256 8b677d53771379218dbcff51d8fd6b6e1338f769a5fc4805411d31237e8dac45

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 342b87b347dea25907078f1023f6acffc6f965126ef7898a5c689316c18c3a65
MD5 29694749b10cb993ab9e930faefd3160
BLAKE2b-256 c16c2e826ecbee28a902ad19e88e5228d5701b6cc7fe94b34b2fc2b956bfb170

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 34082c1a36b6c9c9641e82a41efaea9b5a220b26cbe80adaa9e566e3e6633358
MD5 067ebab81e740d755b05b653d1afb4f2
BLAKE2b-256 89c551ae8c0232290be9ce46fac51acfde2da6785e9ceea16f2c8f5d335d9185

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7540bbc073efa8eb29a46cf02512c5a64146e8d762e6e6e39825ed1bf532cd40
MD5 a19f6f7925a1a0ed69231af31df24254
BLAKE2b-256 7fe13f5c18a68aeffa5161957efbd0839346f013331c0a1433090d6e71410e8e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406261719262276-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6cc1b1a3d1df59d4586159c79085ab1e3ce56706159e6ff16d22f6d06fb17b29
MD5 6b19d4de6996ccbd1997e7c3fbdefc8d
BLAKE2b-256 b5479ed75b402362e9c24f0d83b6f2ab45211a2f950899334710e6683d9c4087

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