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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.2.dev202411191731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411191731932516-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.2.dev202411191731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411191731932516-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.2.dev202411191731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411191731932516-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.2.dev202411191731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411191731932516-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.2.dev202411191731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f1d0de16cbca16d4b044406f1bdb8374754e6abb1793f11366576fd04784093f
MD5 52bdb81875e58951bcdfaf923570c009
BLAKE2b-256 bfa215f706106017b198528b15a7a76891a97c4698ad854e6c727b0eb2caf2b0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 78240c36ef940cc8b7c2cac8c53029e02962906efa3f16f1a2ec7be4072b45c1
MD5 5165ba9f4cc9691307fad939cae6feaf
BLAKE2b-256 fa468860925eeac8c45ed68416e0b6507353d6879d0b8f845f6ca41b0b215748

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6b8d8b60103f77abd708c09e18bb246171dca5ac07c29f19dc487ecea59ba3e8
MD5 7be1bb087c27e6421921eee088420de9
BLAKE2b-256 93ad417c2437b1849cb639486946c477daab628f541005fff53409c98d6e0804

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5a4a8b724df6f7ffd5644ca664e2a9b27a4878576526e2acf664e461d4ab0ca
MD5 411d6d08159a381cead75489cfaeaf6d
BLAKE2b-256 b19baac51cffb890234c6bc0e9dec4400b4b62815577676beefddeed08ca2b6f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6f6a85e2b72b240649dc70c6184c4b03b816088957e9a72b0f44d1948919e03e
MD5 1924851cc9f2ad80718ea670572eb76e
BLAKE2b-256 e484bc533ab823e5c942bbb2111d3fbe7350b5feb873ec8253c2ef077d3c143d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 56b1eb3ebdc2762e4b614a7476b94cc5cf9af129d6319065ff8f971919ebb7d7
MD5 07144de8c8bb3358072fd008ad021a25
BLAKE2b-256 9cad8c2dcec84b2cfb934abdbfcdb76f4ee4e816e9bdc7096186df00094c6532

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1f1b5ddf09ce833d4cd48f60fa61098caf895d85cf6436b54765d7b9ea2f8418
MD5 2bd200ed8bbc55c4035a1214c398e9ef
BLAKE2b-256 0203eb77cbe1b1bf3b02a44446451c6a6f06ec4878506a56ef843c574c2c3dff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b0411c6c3fc56ba19354eb377d549e56c06401228db7829a7e1cd2cedbc748d8
MD5 9504a1d72169d36ae36210b23fea0b2b
BLAKE2b-256 c13a0ce8109ff0d8138021d1a027ddf154ce478ba81b197bffe2338b3febeedf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cf7c83e99fcb1b5129a9e843481e4c8911462c9c244252b3b8a375fcad0ff1f9
MD5 b236f13f5a7f3e514e8a566e5d9ccec0
BLAKE2b-256 8be26f3f09c44470e481d6215c9d0e5bd219d4380922e34db8682894b9d47add

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8ce00c2f48a494a1908ad1d93d8111b267fc11d55bd9aab68389c3e80b78ea5b
MD5 acc741bbe346b6405b8df54553070ee3
BLAKE2b-256 1a8bbe50cc56cd0f0987747c607e7d1743f6d949cb9d7da1c48c469a0fe11280

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3e6e94e6edc0bf2c3cc2d63b416324c5b356afce0b6cf27bb291aa3d32ace7c5
MD5 bfe60103c0d99327f12b084da849b883
BLAKE2b-256 1dc9f7f55990f9f7ad53960c88162978faea8ea20d1d82cabcebbb68345c2ff0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 98cc46de82af19b15f4488f8760e5d7d5ed2304a00e04c6fa4c394edfe989422
MD5 4d674d0a0e478f2072e0c661485f2820
BLAKE2b-256 f2459bc1267d4c489c007847ed3ae010a318d9d2a8d7bac2e9421da988db0504

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 13063a745420f1baae594924cd08432e2a03c6a9516f063ff8419d1614573fae
MD5 61f64c4a7184139d4a98980f55f93c69
BLAKE2b-256 5d36d0c0275042d66afe3c3c2b6dac81b09b5b37f06e26b6003bf15c7c8e0f63

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a0d4eb519e3fa581939ea153a17fee7e121d68dc07d2ad5c11f0ecbf15056991
MD5 64f1640f833b2eff74fd2dcaa9ca4229
BLAKE2b-256 d9f177667dd6e9f4f7d865c0f92f884fa2baadcbc3517d423548c870bd4d30bc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 21fb64eebaf9eabeab5f2ebb33e3e0d98c8fd7075b804fda0914dc2e425350f4
MD5 b2f9b58ad4f39f1895869b999fe673b7
BLAKE2b-256 e2c6e12fc16ad50cc86d7d52f5c4390800c2f07aa0119c1b0404422150bacb37

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4a6d1e3543d7be64a750925b9392257babf9faddb9154ec709a64011fe3117c4
MD5 5f678dfd8f8fc36b4fa4f3e1cd79f273
BLAKE2b-256 7f1add4b620a24efec8d995405687e405a547491cbdb92346741790fecb46e48

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c506f3adfc4cc3c674a340637c3c5ecc06cb68ad992f3dfdd5e0e56818b4f74e
MD5 05da0544444e56c213e9e519cd938470
BLAKE2b-256 6e722a45047865e9b00b30660552d98add731f1588fb0a56fe5b77e149c53abd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a360897a45e4c2b35152ee9e7d8d8ecdd8a5e4e783c665b44481720372aa73d1
MD5 5105ea23be9adf1c99d17140c3ffb9c4
BLAKE2b-256 43bc8d38a7d4f296efbd816b73fa79171488e38d9f772d1ba8a90630a5c1caf2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c01477850cdc529843389499549b3cecc6616f14420c24472a437b5386536ac3
MD5 f4aa8f5de71a5af1ed569b587c2f8a70
BLAKE2b-256 85fd2b74d2d03661589972095de08fa3a362d4c47fb4f8fe85b5d86dff50467c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411191731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b9cf9229c45ba9a62b2edc759944c372f99c0451175c211b417bcce7b3a732ed
MD5 d7eb44dc7d861a51a371215870f381fb
BLAKE2b-256 56e2cde87d71826051634d840735a410873497e229e0707fc9e58d1b56ff19d8

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