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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409171723794729-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.1.9.dev202409171723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 de8cb91ee2aa46b204406df601b8546059b5d4e2ed847dfac731c6ac0751a483
MD5 166d95bd3e70892bb647827973893433
BLAKE2b-256 31909551512c9821ebb3fff89441370e411202943d68f6e34a76bd7018d0b268

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 de5ed757bd372cea4aa1e09e9a977715f38a555e5c2454b23bd468a7f16b70f8
MD5 a19e534ac03452f51267ec0df88a2e97
BLAKE2b-256 7fc2cefb5368308ebeea63a0653159ddca30665bde304eec6c71b10c9c1e00f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 83adf44cc0ca7f50ffce45c258f485d710f1cd0f6c3ce37711a1ba5de1457431
MD5 a5c00f8bc39b870a6e35aa4c21bb7e0f
BLAKE2b-256 b0fd1509e3cee69a1acd1d3c774ff7b7a2f1aa6fa62a52736852feadc87f2746

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fffe4893edad0c795ba07456ea9efca43e4e06a977c805d04908b1a17fd8fa2d
MD5 1907e99639bf7353f4f06a3d589c70ef
BLAKE2b-256 5646d1787d0ebf6ea51653d3491c37b6426d6f191de5e24896abdf42eb47fda6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 76bd19e094df09da30091c82edd651a6da19fac382a80b5d022e96dd1be15a8a
MD5 6d19fa310456e1e7e4d15c5a4ab1d533
BLAKE2b-256 c8d7622f726c29fccad40016c6b384b4e63da3075b1a904f25e40832fe3b69ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 600f747545f15ce7636058834be76807d7dc229b3c3d7d618295e6137514e2c0
MD5 d28b36e8715d5f2fa93ee6c1cc2bc425
BLAKE2b-256 351d2bba66778adf5dc72d60e6028a26c25403f534d83804b9cd617042e6e03c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1922d65294cc188e51bb8361af17eafab42802afddefc65654024819db63c886
MD5 d8fff5e18621f6cbb9f4b62de16dc3b8
BLAKE2b-256 cb0b0bfc0da6fd3baf7d1ad8bae09229c69b640d34af55416daffdf75fdbc122

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 17e320a5d6da2da4a66bdfda821dda9c19bf2a5594c99c4f761259a4c415f739
MD5 ddd7262c550931dc2d6c8ce187c8d35d
BLAKE2b-256 98194a81fdb21c691b3449df00cbe10a7eef42583b7e332cc5032a5aed31f050

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b62c0421432e358472ee049ec8f848b8a1ceb3e878394f581065f96e3ece794e
MD5 e6b8593cf0ae516e9109e482de035004
BLAKE2b-256 48f95f4626a5187d1bddc41784d927e18a6598d569239ac4a68b3facb5379beb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 86039912a00c99c572e396c225a33b5dea8193eb3eb2f15139f46f874d160d9b
MD5 a6625d670fd4d362b7f6b43510acabf7
BLAKE2b-256 9898c2bab40372d8f94c97d89c633fe4af4f9f6066726ad96b5a28ffa015cbd6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 26c737baa31f373797848ba17502eb98847b10f387f697f9c4a14adb13cc7cf1
MD5 74220099976994228e34f8673ce15899
BLAKE2b-256 fc5cdfc06264d83b3a87e1736a7e5f14f1a22f4f675b9e12b5266922e050451c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fe0e73fbc8ed8b4c2395705474b258d5a2797b571c71d8cbb751778466359e36
MD5 fc16093667d55d0ec87238f38e66924b
BLAKE2b-256 a2d65f14bd917ab0dd6959b9d10f1c64f6f06c67fb907a19c80b004d72d8ca44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5bca0046ebcce2bd92f5466fcde17c66ec5e9e4b2d332bb4fe0d35de88f95527
MD5 4ce91a9bcdcdeb69c5c4003c986754ef
BLAKE2b-256 1528c2f58c33b34ac2a80e7204581b31cf237cf09fbe318bfcf5f1c6413f117e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae025b7370676e892ea74b4c6cdf81869087d071e9d3ed8f889717c472f5f628
MD5 a3878b7dcf6535b6f6082124f0280f7d
BLAKE2b-256 a641cb2e67cb1b41f6035b297e22f94a9318ed2b3f8f22b4476c2e8772f24525

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 07339310260e97c045c20eb1e420cd80228e228468d5b4bab1fd38701990f80a
MD5 b6fe3ab80363db26f5729f014badd3ea
BLAKE2b-256 2a56bb0288c2ddefe0e53c7204099625457b12971a64305c27de0fd633d377ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 99b820181ae59282b4f5753900dc3a75192432f6c10ef5cbf70aa53274875e0b
MD5 9df3e1b65d3c8e50d61f39036c9973b2
BLAKE2b-256 aac299f6b51ae95de9f32d0b79e2e270d670505f3dcaeb654b2b1dc39806803b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 01be1826b619171cdcf8f28ff7a95bb33b8bb8fb00d81fd231f017692e0c7313
MD5 cc0c6ff1aa2a21c6f9ab6676312cc679
BLAKE2b-256 4b355d775aec40319817b26b1af888c3d4d048d5a308b8af1155c89276c6c142

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0dcf0ce21dc0d5c253ae7b5dc8092eede421dce1e239918fb4ca54fecfc63761
MD5 4c198ca46bd38d70d74e341c720714de
BLAKE2b-256 1810fadf29f56499b126e0430f1c4b2b7d747507824a6d5d10ab14e3bea9c458

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4fd2c44dc5a0036249caa7dd3ae4b2cf21098bdeaaad916f9c3941875cf8a751
MD5 2c52093a8011d6b7d6d13977ef7bc649
BLAKE2b-256 51119158a2ee8707ef6b1ea58d8a5156f0c52ae81627ffcda5693a4a95c8217a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409171723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 90ab8d11a95977681ee45e3bbb516538fc4217c91bad1677ecdcfbb1f46283f4
MD5 79e54d14d891afd5ee844942ea1289ec
BLAKE2b-256 92981c193e29e97bd9cba9bf47ff4e3fd5929ba564bb135eef5c3bf1721e073e

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