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.17.2.dev202412091731932516-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ad5faea97bccbaa9831e51b8ae944846cfc109971598130f9ce205d72e8ca2c4
MD5 b6adca326852bdb141e2fdf42d57b797
BLAKE2b-256 b36dc67de9871586fe7ed3e0a13f5a6bf68c83c5e9c55d409a86b7cce6f17bdb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e296c5a687b84aea5d8faeebcb2188729cf7bcabe3f5374ffb05bfaa01635b7
MD5 04f437c18c674d746248695cebc85f00
BLAKE2b-256 08ea2f3a86665b157c41887c6a73aa69c2ed7e799ea687a9d3899377813c14a7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 29f2407f6a6a0af0c58b7ae0f34cd5f824f184d63f07f4679b0cb129cf47120a
MD5 62a3c2bf3373d0f6909b9a422f38fc68
BLAKE2b-256 851562175c3903282c42bad3351a819238a3c4ec9be182a302e070c6a3b0d02f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1fbd100fe32bf853e3c48f45daeef9dadd1b040bbd7a8214a55f27a29209cd1
MD5 b2b4ae1763d3f64d10e8407d1ca4d665
BLAKE2b-256 7bcb685849cc9e846352bf2d76707823bf9b5c0a6587e83bd0e8d908f3139323

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 baf19a0fa9d33f43609e3af60a24ef3bc2c49014174ef405be9610d187c3cf4e
MD5 8f62548ba68a5d3b198119ecacd7534e
BLAKE2b-256 2cc62e14e92fb846bd5d68a88879c1956e9919dbf5515fd4894cd3d34bb0c65f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6cf9578f69e13abfa610acbbb0639a1f6e8f5de8e870f57196a38bc7355215d9
MD5 f4f9f49e0a33570e38b6aaf9d7fac39c
BLAKE2b-256 d778c384066d30c1792b0637d9b72a9a53e7844ca913803c8bd8654d8178bdb9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 59b6e87a7158df43eef71bb8e60a89a3c1728732897f76166d11eaa84631f8a3
MD5 285b9d36534008b24f2ed97208856ccf
BLAKE2b-256 f967fcb24b9076298ce66249bd3271e2c75ae9216b03a1971c14c49a3d4bfc90

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 21ef6628cad28ac578ae6465e2e6d973269ed8b54dc3d27df5f5d8325741fbfb
MD5 1e3ee12e0c80f6fd86ac47f067bb813a
BLAKE2b-256 c134609887c6e4c15ebe4c791fbdd39329d00e5b0ed21e065fddc516dbf11ac8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8cf175a181df8cb46bbafd943b196252a25d1ce641ec7d7da5d7bff855576fa
MD5 c78496f97168a9f35ba19e88ae673cad
BLAKE2b-256 21e868083d14b26cf346af3b73304c1861fe334261e00210d46b2d81392c02b1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 54366d756b74b47cf88a504b3878a181463bf4847f9acd2864da9e4dd1545ba1
MD5 923312e46419dfaec8c71a25a75a98da
BLAKE2b-256 1c53ac6f534dc990713a3617bfd164bb6d9b30b4b4b37567d4b5294919b93391

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 218dbc928127e3da1d44f66af48a8a4119f2393ec11f3d40dbe88f1745e13274
MD5 23d1c2218d91350fa8fcf1fd3ee743d9
BLAKE2b-256 19f3740ef0bbbecdf964976909ba215996d9800692b9b0a04bdccfd6766a5e74

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e1e46903c95ad5a8443bf95f805dbb17f060b0d852ad0f9d0766cacaf61a772
MD5 d3b1a5999aeef56401e6291987e6e97b
BLAKE2b-256 c4cfa4deecb61e3dc2fbf39c8913045f08899c2fd536af878c5b7058e8db73e9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 be64b507698f3081be14d865a610be3b6853ef7fd6f9cd5ce2278da0078f6e0f
MD5 fe2aa32c9e2fc2af4ba84d10c48c5b21
BLAKE2b-256 0e14e7a45a9c5afe50c4e00b166095895a298341ab37932a70db5a788668a014

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce2d01acf13597c9adda4d3893055e53bf3354a78dc2a98ce8a380c91427995c
MD5 f6729a92e8f5be62e6c9e36486af6021
BLAKE2b-256 e8102c4d15d7fc885c5e75d4cee57b87e852cb54729014a172f01573aafd3d56

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c914bc00503df2f51e042185bf889cffddc5c2d191726a69c5411d0259208f72
MD5 1a360b16dd1776c328bc250e3826bddd
BLAKE2b-256 38c6a0f7089c00831b061ae810198ed19b2194c3b79ab01996ca1584f29925ba

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 849170ef19e7108a23060e2475e7f3575471e6053bfa90481effca93945b6384
MD5 295d39bae37390bb5717d207f8712a3e
BLAKE2b-256 5a63a9728443ccf360b8a8a8b51ede653ceb857c872f611b32fe01b5eb85a1af

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17888d2dff2c44a3eda1ee17d397b0f006a371e19ba5d23802ea431178a57239
MD5 1955e267eb3df66e233d3bc544e4b243
BLAKE2b-256 da983439caf6854711dad697488943cfcbd4048b90c21c77532beaef748903c1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 06e5419d5f611284a6958d395354e875897bd3fe4db4ec32f60bde4837d0d6a6
MD5 155da93eda409c1a393b99dfff3442e6
BLAKE2b-256 bfd1803da41c76a24b161b094ec5355cbe321d0495be9c91a2ad23c22f064117

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7322a3f8895810ae953d4b99e499eddb01b4bc8c874a6c349bfefece3d06f04f
MD5 57d84ccecc281c279359abe022ba307b
BLAKE2b-256 fdf31cc0948fca565da8922153559a70b8f9a7d1d4d5197a1fb2efe2b8f110a7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412091731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9512c9bbd2bac8fda4a80bfde24cfc47b84b33a3549c0f98967e94458d7ad32e
MD5 4f20b7e504b232b01725d70491757415
BLAKE2b-256 212ccdb8a853f92398b504b2351453adf36586db192f851a2ec8a9aa1ac2e1d7

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