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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411051729615378-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.17.0.dev202411051729615378-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411051729615378-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.17.0.dev202411051729615378-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d1aafadba804895729021e1b0a6551d343f2011160b5249ad00d231ded9c4759
MD5 d4567d56af6d41650fb8226027fbc5e4
BLAKE2b-256 ec43aef73b3758054b072b4b913b17dad2d352bcfc710ff0a0f9b4cc0c387cbd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a409a3b0f3b828936d8c21f4ba326ae68a79f3ecdd5d36a2c18efac513769bd6
MD5 4ae954c1e622a02cd5d7cd71d6292511
BLAKE2b-256 64daa7d263f8736c1640375a1b4c9af5ae604a8b3e294bb10cf3809d40673c68

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 395d4e82984a3778f05a4393c32fde8b42a211ba4714ede4994391682fb4b3b6
MD5 30e823b47f020e0c73cbba460b38d9ad
BLAKE2b-256 fc2975836e284d00e1797dd111fd597660276dbb253723174835ce96648fc97b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7d329db6cd19063a479f95a4f14f7608890ee8bf696d9905dc7543d99a920e1e
MD5 696a8b864481356a7c62571dcecce32a
BLAKE2b-256 acb2b6b45de1000405a4c5e75c28b6c2e7d570b5a3db6378647936268001aa79

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 900a0c8156f891665133c9148369aa486e350bd748fdb2eda59ed6ef10c93da6
MD5 c44eb23aadf78510fc2ed8ec24ca2326
BLAKE2b-256 717499c5bf4bb43ba16df0dbcd813f438cbf1456b5c2ccb1ec00afbe6d493a1d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e463d50981e21c31c800ddacbdd454ccfcd95e606d14ba540a404c4439b7891f
MD5 eacf869b7875a7469328cc1df74c9385
BLAKE2b-256 a19222027d8f5190b22b811fba274d42848a86f75bd60722a63e17fe08b4d28c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dfcb0984a3124c226370fa004c2ce0a3cab3d578f14e17981489808ec4640886
MD5 35356b29175ebdce45542d8b9b9f4f2b
BLAKE2b-256 19cb8e42e78f63f63b889304db8faacf42643328bc08f0a6de70ef3901c2664e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 daad3dde7b3c78ad1b06d2f427a82c834287054e6dfce3fd2bc8d43b04cd0f71
MD5 94ad8bf79984b79e752eafb56f6be898
BLAKE2b-256 cba6db8e768580ecfc4f22c37ce9baeaf0fc7b126f8a30e06b01605423d39af2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f60e2e7e5baa550ee171ccd915eb117ea211223807dfb5360e4af9b4a4fbfca
MD5 ab5132c923ab9d0560d19d08e50f5e25
BLAKE2b-256 f3473b2c500077779ddf83fb41acc57824833c2a5ce77491a867c571d2530cd1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9b8e6823cb36ce1ab54fc8567593581f70603fbf9a8bd0c0cbc48fa9bfc86604
MD5 af9338ad513b11f97edcee4d3b65d208
BLAKE2b-256 2563f6133b11219ddf04158a59000e379ae64586f74f7ccf10f37c1521204358

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3fdb117c41f9f8a9a8da3d12bea2ce9cca66a577c92cac80b29ba83c2ce35c67
MD5 ffafec24e8bdffd994a27520b7174957
BLAKE2b-256 8652d7e90f7dbb35e20332fcdf7a43e775816c3ea8889924a30862efae5ae0b9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b0711bc3fb28b6c3ac89d99676ebe1469ca659849cbcbc22b4dc40eab26585e
MD5 f9bd15926eb8503806f4912f8c873be9
BLAKE2b-256 5fadd5abc1caf99f0ba1f6208b93be517c18481b8de4d218fb20390e856a0d41

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dd1156433c17b621f354ec242356ddab85f4baa501e670e561796fdddadea4e8
MD5 46266ba81bcdd71aa06fe09ff092948d
BLAKE2b-256 8694c104b5757b1506cb3ea0eb99b18ca01d8947b8d4b3954b70cb242b5ca977

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5035226037d8593159a3dd6ef28efaba34dfee446831de69c35a4fab73f9afc2
MD5 c587738afe85b5c7f2b0a801f6ed977f
BLAKE2b-256 e98aae29d00b2294af6765ae482c16a6abfb4f51c719bcdd21a45d3bee8176f7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f3c322ec2f2ee127f23acefc30280a168bf849346738c012f08a106a366754f7
MD5 ba14723e890ac3cfcfd5d2db3838a81f
BLAKE2b-256 923a80296d239bd629c876227df5ae9ee7e279d9c198f8bc10a2e63e50459d04

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c2166b9b62d4f15ffe62346c771c6b5cfdb42be584e2cea78f23e579179c51cc
MD5 c353034dedf0d6533c14c24f02fe5d26
BLAKE2b-256 eb0624b65a627e0573569bec2e65a3bcb95e65c740f2fdf9efa7fe2a97c1c31c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2908033732c6cbf2db5de7bdb0d36378d0e2a23122e7bd9ada5622c063344b49
MD5 124705d0eab6231ea4a9a7eeb443bd1b
BLAKE2b-256 7094f6a590d39d0dde33481858665e9f3c7560ca73521791ef0bb4d1fecc6cd3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ddff88831726fb63442356475fb749982b09dd895d2fde9f699c0759ca68c9e4
MD5 cb7c8a2958cae892031632b4e27aca98
BLAKE2b-256 01aa5b8965aea1ebb61223916e6a14a9f594cec0c3e2d148864716f97d7716da

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 32ecd57ab076655140475567f2e1564b8125012146005944da452a5e06e2253e
MD5 b9aa246f62557163a40ada9c339f88f1
BLAKE2b-256 8f8a9ee4dc3e0d6803b33593a62eb09b5a00c1c99ab46195d2c16c248b723ade

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411051729615378-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9085964843c7ec54198f5845b27e3978569a380be537ed05078abdc5aaf12280
MD5 fa9b77a4032ba07f53faa2efdccc9d77
BLAKE2b-256 7dfa1b028799557377341fa7e514d530a0a1c02df08bd4067c7aa44cb15d167f

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