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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406121718113029-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.0.9.dev202406121718113029-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 72d1318b62a4992ab5e5f9bf44ca358594c92e94111aaaaddd901dbc71e7118a
MD5 a4ababec766b62f627ff7b495b5505d0
BLAKE2b-256 c585fb98dbe623ce0aa23fded35e86a6bc3049df78b8b0ab7eae8180ab0ed5d5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a360c47fd1761ba8f60add372d8a389d4dc3f03aa889c5b30b03119b3b6f4fe2
MD5 c920d5b1d3a8079db78023e35327db59
BLAKE2b-256 3b0d6818a9c1949bd0add9a5425acd5946878ae07b47126790b9db5c7685f152

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 833fb24188a32f64c1dd854068eb61c1f05cdcbd0027426873c0d842bb088e8f
MD5 bd0cf9749848a583c8f03da3c58e0550
BLAKE2b-256 87f12709f9cca0aad451413a189bb763137647922e63d7a014e8a44dd9b751be

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27c9d114b7cf9c42d278fabed10ee288c5a287250e106859f9b6050875b2861b
MD5 bbd5a22077ee427cfd910e286c4aa4b4
BLAKE2b-256 8a7e9fb196b4c3699d83516af518b8257710673ff3f68aa740c71ce1ec817093

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ece302235ef71d8dd492f873a2ee4615b00a3330fb13363ed753b5e4d3e972b5
MD5 6e0373845b94637815de6513b1f9c52a
BLAKE2b-256 80605830b34f807dc1543090a950d31a4e4cddb6bd6f618ef46a79c05ef60183

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 045bd5fa1d88c91218d3748096c0c0e272f964d759842d7821b0feb808d32d05
MD5 0d50b9cacf201bc0d786ec95db60c5e7
BLAKE2b-256 e73eff0130f23aefbaddc64f2bb8500d597492a275417e7e17f3389fd30d60af

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9d3ee14d2a177c54f93bb1e07843841092e387649c502ca780c3f2b00c9c8bea
MD5 45f3c3abc72dbf216fc32185742a63d3
BLAKE2b-256 ac7fc46d776d489837407cee48616ecf9668cd19e05092412321b0f97182e7b7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 36ebd5034b15ea90828962d0e7e5110df53b69b09792abd76442964613dc1fbb
MD5 8c292d77ff83138057741ede7507440e
BLAKE2b-256 bbf2008f73f76068a3d2ae66e3121d2c1da914ed3787a494aed2fa4714898f60

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7ee0ea37039a0f926f7d67850b59f386bd884fdfdb1128cbd5c5a46f9750bf9d
MD5 adc390644158fb0a810f070b229cedd0
BLAKE2b-256 744e617a836dfeff5e7330b5a27d36a5a2f1e5f76faf1b2e8b92da87ae53d1a8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5ae595847665064ab6be2bb92bd8e556743102138be4caa47c416641cb10a06d
MD5 ac56badc5e9e720be262107c08b5a4d4
BLAKE2b-256 0b19069bba10cd46e67ac06ba9b451645e0455a8709db2e1c2090536bf9e334b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c6027c3ee7d2fc023a35396524b5bf157134f548e9c93c64d1943fa5bc950316
MD5 f1ae43819bda578a43ae5a427909d174
BLAKE2b-256 fc9e0cfa4dc7f92bccac2f820418b9a6af7ebbd18676897c77b81e2badbcd1e5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 76e9d83fb715106d09d9e743878d33dfe2e45706ba12e0b292a94989f4b095ca
MD5 564fb57a5dfa1a0873a984b579888fbe
BLAKE2b-256 4541e2b0be07f05eeca366027066e0d185f31cbbc2746495fbc9329c11ec8c01

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fa2e0d1aff4fb66c44f6cef6c679a4b1eb1af70753a52369070d35215bb12786
MD5 062592d928b1e07e9f2e0592133b46a7
BLAKE2b-256 c440255d95e401d2f2d44243a6044b7caeee438c0e63711e13c31d67124ac261

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d178052699a4b839b1ee4b86ad21e4c8f58cdd9c8343566d0b75926423dfe90
MD5 d377b1a200cc894934f695e49d28b51e
BLAKE2b-256 faa501e167e80deade83323e309b9e19868801364153d774ccb6c9fb01ed971c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 94cabaa5f32468d9c4ba32a4d4a623da84fd2074bd1c19af3970c3a451ac059d
MD5 30ea405ff40ffe15691666eb6d057318
BLAKE2b-256 a71d7acf960c59b9ec7e348801d8a221af5b8e2220d9459ba4f16d49a17444d6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0803e848648defd1792cbf9bd081c33d3775b7d6ab545ffc9416f4dbdfa82519
MD5 53c8bee0768ad5d71c3d81697aa35514
BLAKE2b-256 6366d2c38062bb5df8766760fa79ffa09d84a68a92c406ceabf5973b5802405b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 108ef207491ef4a79b49f1958503cc332915e2d6bc9c9ae3fcad2da4382a7ec6
MD5 d351d229950be7ad80f5dd1edd6b9d51
BLAKE2b-256 8be5403a1cb175b7fd3a76ec08ba78d44faf8e625640df470cf30c4a4f6b9bf0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7b856471cd15c510b1b764c82aa2200b656fc5f3ae92338b5bf6485f688b0d64
MD5 bdf1687828155aaa174940f0e99dfc45
BLAKE2b-256 54e00c9fc2fc6720a9575fd780cd480decd58b6bb648bc17b05f0a1244548132

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3cfe464c515e8385871d4a1c82464fc0415e5a4374058dcf6edd59f97f85fb26
MD5 3157b7456e31fc88166070aa5e055231
BLAKE2b-256 2cc3958534505b472d10424937ae3aa745e2cfcb4b1e289c85b2fab0cce4a6c7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406121718113029-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6c58dfbb9e9c0477c0a15e3730f04306b7cfcd8ab3d464f624ae7d50011e8c6c
MD5 040f1753bb81faf3c3230d243969e847
BLAKE2b-256 8a5f1754bb4f75c927c7abf5079ec8381a705fc73c5ea3c0bb941f4be6d86a3b

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