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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407211721169663-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.0.9.dev202407211721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2aaf494bad770ffc87f6e58a6405fe6a2b782516255ffdfb43f0efcd4d06b543
MD5 3dd3937e857e488eb739f928b6cfe551
BLAKE2b-256 f3eed9e25c852c14cfebad6b2a0e6006f560e0db3ad7c44c9808d6ae4751059e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 36512e22c266773aa43ee227a441a0049e96d7cc7e0f63777b48f0b60d626554
MD5 e9fdd619638c5df7e08c1792c2720d39
BLAKE2b-256 038349746f9becffb22229fe2117698dba92e426d17f972b890fa4ae7c7b917c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 434571a714757ef7ec7ca6efabfb68def110b0654f45489ae4b00d2a88a96f0f
MD5 ad57a5af14c4da572276d73cb0d634a8
BLAKE2b-256 4ec457566d4488740ea5c1a54f9c4b66d5bfd2c7a09258ec4487ee7865688ea3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 737952fd7053fb5cc51dcd2bf35fc2652ff669c514d189b707f3a5bf5558e1fb
MD5 bd3cf98f2fc3bad53aa0fc6c7087f3f6
BLAKE2b-256 d6f8718d11b4ba2bf36e1ab2464ee17a47aa6a33753118e96639009cf68790d7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7a730fcf4c4b87af4475a2ca48b3e9f43a289796123da82d55ba966eaada6a34
MD5 e3ca49fd3bafcb53e57d8123af7aa8d0
BLAKE2b-256 6330eac6767a5dd8f700b6bbcd0bc7cef70d9b3ef401afaf345c4f677fe6e8c8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 aad50c7f4e200f97cbab2b001d5ac93b8b688122fe98c8f5b8255f9bc5bcabf2
MD5 4fc4c1626b3e2b362a13c73a6bdb577f
BLAKE2b-256 239bcd935413404eaa61591b9218eba0b301e7ce581d8c87f22f2e3cfc61a587

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aec7a944283a6622dc8b2a7b58ab3ed5ad8c3338c7677a752a11354f1b0ef230
MD5 f57ce35f98a84ebae25fa7da1016b2f0
BLAKE2b-256 b429509499eecb6fc0f37b3c9c908e2333ada11183f8b4b42ba55bbf61b79442

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c9e078518964345a400e5fd2891549202bf36fbb7c778d92bf8ac5267e8974b4
MD5 870d4246f62a41e79c9eedf83dd9a52e
BLAKE2b-256 4b9bb1ef6c55a2c00f3eb00aa099b92ed1491c9d3dee0ba0b3656ca811d4e7e4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 888fa418dae75ce6d1c482e1c7ce8507b7e96d1af287b7e6c1c8464889f1bd7c
MD5 1a71f79d5f9f819bc1d917f290218838
BLAKE2b-256 402799367162fd0803c0b080ee4a28e018056ac776d91673732b3c83d9bedaa0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9219d721540b22300f10839db09e02b18f89c4f7e01560028d3fc34b60d1557d
MD5 92810fe57ab6c1473c685b4eddeea9e2
BLAKE2b-256 6c994efdc7f6dd62bda71438246eb42edc82e7cff9e411bbe533f63db70223d3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 217db53fef6cb425b721be56cf098a2e20dd658c05750bd6a32e1871a0d18fc7
MD5 ce0cc2c85cb3738268cae5835d1bf40d
BLAKE2b-256 7ac234361d10da33f3c43c904e789967438315567a9a7749924b70b6e4ec06d9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 279e1acaffede42ae2239fa16cda7bf4fd1b309f1442feedd7b67f3098dd0371
MD5 cd17e6ab83080c48129a5b5420fd63e4
BLAKE2b-256 138c3553bf3618b46b6d4f9baee1869bbc2a5392e035ae0da75d14a12b11fd8a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 780cd8ade31946cac81e0669b0433718a336f4b7a5e6cd53b4d46786900566e7
MD5 7e9fe9ab5850040af20cb55289873617
BLAKE2b-256 5f76756b5940951c76b43636fafa982771bc0ffe27589f8a789902b6e2136edd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8e8b36b679c8c1f7fff228b42a41057d570604bde615937e020ec80796a1dc7d
MD5 6c9084020c9950d34c0e8e7a6d57e57b
BLAKE2b-256 6361ea2c1ebabcc3a6b6fc99331f1955dc6211631e94f6c4a28dd85926dae4d9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 31d7b932594fade522cf9d1c56cc1f7b8012b2ba50b7d012cdbfc0cb24d71c81
MD5 052f68d724459abb20a239f8b9ae5954
BLAKE2b-256 d046d74e7a0a4be0c7657e19e2e180beb2c2db129e2904f585a057b5cfd1245d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fd11bb803e1ab2ee029c0f519abb00c53399e0ff51ca2c8c5bf1af5e56355e6e
MD5 80619da4fc2fa34d87299dbdd4604541
BLAKE2b-256 f4e9560102d208689faacf4bb18ab27978ef8e738a1560eed685a78b4b2c08dd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b8d03ce67df2edacfc7fcbdf5af5afbd8eee05985aa2fe02c2d1a9b5ffeaca2
MD5 5289f1924a4bcf06a9ddd6dab60f7aea
BLAKE2b-256 4198148e35c80685aec74278736e1b7b8d6ba0ba5c8087d82f23d02dc3ae56cd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f784e4e233d4356fbb69dc57bf184b0d3bd1bcebf2fce57167fddd54dae8c8ce
MD5 a69f420a3856484e89bfc75540809d3d
BLAKE2b-256 8145387bf5e15e492d283776d324d34b1756a41c7b7ada25ed743a119434d16e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 963456efe51ba3b73f0617919fb6e7a548e5600c6a8b32d09396d4c561ae174a
MD5 a347de7c3e087107e4c9611aba16efaa
BLAKE2b-256 4e1cda0d5291d9078a6c24feb14d4ee3ab08cfd411b59456f5716bb0ab9cc353

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407211721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bba93e2b51e5d1f9c10518ee4b831cd790563d9c9739412dfb507c19c309d18e
MD5 bdf5a1659b74b5aee4a1cda98aba931c
BLAKE2b-256 3e530fa3619a370f6be169b624ada3066ef9aa71e3b36182c8fac591b4e6635b

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