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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502051738433769-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.9.dev202502051738433769-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502051738433769-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.9.dev202502051738433769-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502051738433769-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.9.dev202502051738433769-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.9.dev202502051738433769-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.9.dev202502051738433769-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 11293596404d83da9c6946e10c975dcb7e3fc07fbdb3132ed6fffb55bbad76d8
MD5 a7ce831068223d92692695750b95136a
BLAKE2b-256 c5185a5265d942109c7fadc86ae44427ebebee1b6d1df176725e4ee4769a2358

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bd534fb26815db2d90fdf33e393eb014e4a59aef8e1b7cdef4dc63d610912bb7
MD5 1a49c0704c1df435cbe56efb4df0880e
BLAKE2b-256 34eaf89d8fc03ff776b57466b148b14f6f37d6efc37e99e993ce3f7473625864

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1336c24ce1d766065faeb113df521c8072ddaf8afa5329bbe20a39e9241462fa
MD5 228da2e063a1d468c834d27abe7fc5cf
BLAKE2b-256 2cfab4bda337d83637084d03d994114e93e89c5b23bd886b8c25dad98e331f72

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 23e4ba5a81ab975ae97e2281851da83707dc2a91538661304e442425a7ab13ac
MD5 8558883fc85a73f32c3a6a09d7c2a3b2
BLAKE2b-256 bbe39da07d5eee166c6fab0aa04b711d8aa6975c20508ceacdcf3b22ff0ecb2c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9221d75b17447ac68a57a7c15c0aa463c8169c45b6b01836cc8c22033d0220c3
MD5 5fa1357be26bec140a1663533ca3b58f
BLAKE2b-256 436cfbaa3d0741fe1f5c94d8192bc0468d42d1dacab2a5d9039e5708fade2258

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3761113dfe9df066ba58d181ee3a3a65b7461677cbf024e806cf1d34f648ff11
MD5 5eae753ec2bbbe9b9f233ea1a38d1802
BLAKE2b-256 ff5598da284ba1adb6661d281a67dbe0a26e3ce32eed688adeec20f547cfc111

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9d128083985a45f21a6d98e903a6bba3f5a1da8a88440260b0fc66d08b46ba50
MD5 9f160428a998a3d0ea5a9c99b6580b77
BLAKE2b-256 c4b098d31d2266c64e60c2820bbdb4e643b0381c1c6bac4dba43a9b6f7be418a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ded3322142cf6a86ce416868c55f098f2dce0530f568442405ea34bff9b88683
MD5 3d99553123c16d621865e26888c43d01
BLAKE2b-256 16d83f9ffd6b43f796e6189c046a3c2f635f9cb185838842cadc31ae18ffb8f7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48641286f1be7a53470f409f92c89ecf5070f8372389766aa204c4d979ef6b97
MD5 ea25cd29c8e93d501a804657be6a6a01
BLAKE2b-256 2a4deaba7ed190587132e43961c91c1caf08ba3ad4197cff7a06b9498e3d3f5b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 74dd6125c8e912c094b060d58c4d1207113ce9bf889d61d1bfaf284f24495ebd
MD5 1e7a0e03a0c47338130c1196ea036d69
BLAKE2b-256 a1eb4b7895b17e44caa98a5809a8fc831028fad698ed8095d8624475f79e2b35

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a6fdb6d86597e313ec77f879d70a394c38bb9198157e6e5ffce166f9b1e1fdd9
MD5 9d7685d6d1ecb86d3efd343c3032fd7a
BLAKE2b-256 1493cce3dd6098984a679774a9b755d9e7a05ea2ca42333956b3397c6f1dc258

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 22137096e16073c0c31726993592cbff2f285665f498a05795515df78c7d977c
MD5 7342aad34148ce1c5c58299a3e748617
BLAKE2b-256 fec005b19b37d16bf31ae20a4ff0ddb3aac03f090004a4ad87971448e8d26ff2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f19d8f911ba63d673015e1e400f318ec67f44da8278f0568f147cb50dd1dfff8
MD5 e21630e8cb7f413c947fa52c553df13f
BLAKE2b-256 23fde231e60d3ba70a08e4cb79b1f3a56ae43a0f21c0baed61246e1497fb6312

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d089e198d3462a78a9307a4ef8d4dd5db369d3496143b7f8cbe4d10cbece9b2a
MD5 fe6cb41f2eaa7335c4e83328d1f37e41
BLAKE2b-256 0297ebf95e35a399213763d81a473750662f8a259d7d984a20adc35134cd41a8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4d147885d315b97758a6cf1b90156e5cc7ca5168c467b4001dd695cedb88dcfe
MD5 50de6ed5ed4a89310f4944079c50a45b
BLAKE2b-256 15d1001f2d147cefca966d4bd7a75cae99b37fed8b3b81632f01fc0e22c49ce2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2300ec9c150a2ef27b0ad9527cd5aa25c4af6fec3981448499ce09a6183a2ec9
MD5 ffd807c0b4041aac2064c419419027ea
BLAKE2b-256 ee60956fe286c40954731dc515499c10f723e249d2d6d80342ddb9116076ba31

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e1b854f7574bbd7912c9caf01ef1cb2875b2ff30bdc07ab259e5b61caace585c
MD5 3b80a79b2efba3407c0f649c8166e545
BLAKE2b-256 5fbb334f5a71cf327da0788e3b6a9b9a32965529bda4744318e8caa93b675cf7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 daa428d1ce5db9a54e3e82344d3dcec4215bdd12299fb667a7761c80174c7be0
MD5 2a0ce4eaa980352da06492afc90d4305
BLAKE2b-256 1229dd316d8b7f729e64612632f5da33de960996d9bad3854997984123fbd1a9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 313125d3b53acedb422104feec097fd884e455bfccbe11f88bb090a6469d32a5
MD5 4da2ee2679fa7166471a455d5db8da8b
BLAKE2b-256 f52f74d4215dab8c3069c971ff3dfd767df2cfc985f0afa43b53c9421332d247

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.9.dev202502051738433769-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 092c0ec27d78c99dd3fed075e0d01cdaaaee8c4fac476871b24d4a77d619a87d
MD5 d40af247e57132f4d5816f7307481c05
BLAKE2b-256 8b0c13dfc03fc18927e5a6ed3ab48e4f3df218afc9188c390bc44afbac60421c

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