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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409041723794729-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.15.1.9.dev202409041723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 aba23173eebcc45ae0b7bff1c53c3fcb08da4007694ae07da9c6e4018c3f17c4
MD5 79b99292ef3110f340943a9416ebd068
BLAKE2b-256 9e937e8774755924cc5fcc232a798a447f11c75e1b371a1b4707578bc9bc9be6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74fb1dc31986f9531f4c74521cdc406f61336a02d0f1dfa284fdf63d70acdea1
MD5 415e874589c05c16b74819fab1d863bc
BLAKE2b-256 c1d52aca688829fa7aaac266e3713b3720fe66d3ab1bb3028571e8523333fa48

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 479cd000aec6aefbb05020bdce26b46a16fc0593178fc2ebd081b7726733ae91
MD5 a07e98165157fad6317eed5520a3f93f
BLAKE2b-256 2ad670b4be0f06b0651ebeefcab62589db0f69751ec7b188cae1b1406e89d0f2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12b176d23c734d6a2bcdf5c12916b52570b934b1d408488906025249940eb0b0
MD5 c506ac1103dbaaa34dd348202f1307b6
BLAKE2b-256 3e321a038fad356aa274d56f00dd6df92d2d6c60aa6145ef80547f7f779f76a4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 51b1a576266c7232aeab443551866382cf3e5f08f26964b015f40bbbee88c6a7
MD5 a0527625f9a925966a81a7564b64a523
BLAKE2b-256 24c22dfe0dee6d77419369e66bfbf8e44cefc9d991bfb787d789f14c24b5beb4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7aac1b9bf2c46cc4eb2b6d5d199f55d132b1fbb4e4d39d74dbb0511f0327a99f
MD5 0888d5a2a57a459852e8afc3dedd4826
BLAKE2b-256 243fc5b9ca670e1d3f3c8cdf0aa06603cfc3044d5be53d0daf52a2fa6d367546

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e86a2674fa43789d780e6b9b676589c4d43f4d34b7411f69e4fe01ca69940f4f
MD5 b4183ebf98613adaa2155956cf714df7
BLAKE2b-256 bd2b32bc5d15362277eb94cd6977d4b7354b6c87e5ef0161a85e527a84a1b997

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b9ee74cb2963ce64a07fed26545e0f8f223d0513832782266a07a0f609ef2d86
MD5 94092b44f4e75dae9c0a5aba785f3ef0
BLAKE2b-256 7ca43c42da10d40f0ae5fe22630ab1c5c592dc108e539625f1067240b408a8e7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd2ddcbbf64f0256f6362c737c5219dc0d1e7aa2bd278241f43abb6bc0868831
MD5 ef26e8dcaae0d147585a78016c8bbfbe
BLAKE2b-256 136b7de4a967fd6eebfa3f54b640cb1389cdc23fe413fe5514a32c9663010eb1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e5b011c2d22d5d26eeec1403a0571c420e740dd5e4d9a39dcf8dd2ea868b3a5f
MD5 205dce63d2e377122928e0085ed003af
BLAKE2b-256 b9982361923f060a47da6f6e1a220c969efcae03c51457d2fbbd6eb06877a58d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2b36ff029ec15befbbe3baa6111d26090218dbe18b084bf73473004497832ff6
MD5 514aca61b39377123324682759ab24ac
BLAKE2b-256 a98b94fb06667970de2921d8000cc5b995b2ed14815dd44b65513deaee055bb7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c390330cd19530e25f8f91f4c3e4cebbc1a5556cdd935906ae48f22c961b40f
MD5 1bbd8a4c386ee639399c3fe0abab9289
BLAKE2b-256 0c60c5ac55155422d7f7e70721b0446d3d0da236406260540f2e0df21e2e4782

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 323d4204817054097e3c9f31c74fceb8ef3faabba5bc76e667d23b2fa36f07c4
MD5 ff9d760317dc4cbf9ac70cb5515ea72c
BLAKE2b-256 e915ddfab705c909bac7f7b398846f1de12981857d0297331a59ff4e79d57745

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50c520d12ab3c62aff44241ba76de4af4df17d778397f44eba44b28ba3cdeef7
MD5 9937abd67ad88850980562d80932ea55
BLAKE2b-256 af99c9a6f5940c78bbc0292127f4661bd7f34c7a5e5bfc13c52f940f79566735

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 08df5f876d0ca675473dc1c28dd3450b5414c29aee91909969c042776d60b2de
MD5 f6127d5910e8196839b2ae9676086218
BLAKE2b-256 4e95773a1af7d3a63c2bddd27a3faecccc33cbc51d3077b71486e58819b09bde

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1f224b392556892621298a64eb0fb58ccacdd250e2d6354b2629308a6fe36d34
MD5 3b05ad209a0fb7c45185aa561707f0b3
BLAKE2b-256 5a515bb5ef2d70a5abe1e926ee00be5712de936670ff56c67ebd59df6a2aa04c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a472030fb7bd33820fb7ad5df1c9105382ab22b98234fc7c635ee700bed1538
MD5 f4d5eba68a8775c868b064fc4291a539
BLAKE2b-256 886a99f6bb0165f45981f73db9b5cc8e5267bbc9893baacf7df0b41d723703e0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 072003d84cccdb50e1a50f2de8782c9efa00fd7a9f9ce257a2fdfb54d2428405
MD5 dac1f3cfe562dfd4dc2dfe49d7d6ffe8
BLAKE2b-256 1d599b0b851fd45fd51a4845d394a91f4d58ce8baf24e3ce6b1da42d7639e237

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 489b91ffea20ae3c3ddbaa23d6e569a2a312d95602160473166c89f8fce0ba8d
MD5 48a7ae912c51b33729b3882c121784eb
BLAKE2b-256 3a4e691f4f6e90e4bf8e674c3637d838e2e6d2f4e1144c2924ed63cdd909d49e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409041723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0f66ed025b73f1f5f8fb62545e5fef932e3da6352f1e559443b5c60779def249
MD5 9fa177a51cc88ab6f96dc86b0b7bb290
BLAKE2b-256 c5bcd1f0cb8abb069c2afe726c78fa2ced691225c486e8f1130b0482fb75d42b

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