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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.9.dev202407141720623864-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.14.1.9.dev202407141720623864-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 06acf2d6cb3968f3df79d3d807634775b68836ee85b3aff9dd5962156d940703
MD5 056918e14ea38d9c334b6690c47e7570
BLAKE2b-256 5e5f7647452cf4483309739f5d9a954560de8dae469bb7912ad6bafcd47187da

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d283a7d1c5e86e82c86e4e68c69860720792fd96ddc3fa0c937d5cd43671570
MD5 de9c78319e9044be43aef8608a360819
BLAKE2b-256 d253860f1eed8306aedd69e40f803697707520413d9720a379bdc5f01a1336a6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 98cad52ae9e7a2726e0fc05eb537ec506b3ae6c11ae55e53410f8b091f05e510
MD5 dde53c5837d4a9eb16c07efc9088d181
BLAKE2b-256 2bbec5b78b95354dbc2494c09cec4f98b3879226baceacf65adf40a2ec98eb90

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26f7c23c086ca719d04a62311f2bc9011a8c71b28e58566740928a62f451c2e1
MD5 69d213a3d3d942d1474259f245b1db45
BLAKE2b-256 59fb239a057faa4bbcf3c0dd018f479ec66969eddbd8b33e79377c5b2baba477

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a669a77a2d9db515a59bd353d31b125c6d02ff3d1da69873c6c87cf98183fd85
MD5 958258ee1f1b6e831051e1634058a83c
BLAKE2b-256 ccc7541c5abfe002953fb56b37112f46ab477968d2a1c599c042cdbc9ebc995d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 417794caf428ed0531cdc4ac43b16de5543d284eb665cf501972d0310f9e5374
MD5 4527f9fdbd74753b61432ea52f717679
BLAKE2b-256 dfc787ad9787e96dd9ec1cea608765ab75b70f7aeda64100111399b044098396

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 584aa5547aa556f7035305bb33947ad55a64db7c7e758894a8f8c66080827a87
MD5 690be78e4847842c6a2c3b68b8ae48f4
BLAKE2b-256 37a467d6e1044d1e942039e12d2f37559afec24452b8732936f297d8752b6f24

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ef4f01715cac83173a26701cc93df94bda84b820ff2d361ad7dea590f1b86d6b
MD5 27f8512281c831792f00034929ef4917
BLAKE2b-256 f9ced4b2f49cfd4f04a52fa6cb16540dcc3596f47aa3a59841e43e8541e4c07d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5479782c2064b3c1ff32803b1978e6857d09de310a763916bb73b8a86567f8bb
MD5 0889152fa1e149ad2693529d38222bde
BLAKE2b-256 5376cecf97e4b979cfcc14acd85a12e893a01218a819804d7843b04658930f73

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4023ab6172c4ec26a29e4463d2251de89675ea78b4fe86be7b2f620962f4b38f
MD5 eb1d8fe7042ae75b49e3e1c269a59b3a
BLAKE2b-256 b0b898a1115cca117c8523cf70b06287c5421e271f8b31f26282d79a0a875ec0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c12a9ecd9ae6fb43c41a06b1c82b52c0b62536477df7eb8e635c05f04304825e
MD5 30783637bf2309d67ae1d71bd3e0439c
BLAKE2b-256 d17afb96f289c6798bcc959cf9bffc61c7496cce9274a7c08ae506a9d1aa3da3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 77e55c59b9a9bbacfca7c160ecd5400abd0e9eeda990d2cd3985f04ad94cf68e
MD5 6a3f4752b0fa43360fb70ca97b384ba2
BLAKE2b-256 6ab808319ddd35ed362229755b09062db7c62033209e46cbf2d080db07468933

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 25b3401de28529fece0668a41638fd8393314933c10fcdeb6db0d63d41a351b7
MD5 d863a00d27ee055abea38c506519b020
BLAKE2b-256 b52aa369c8c79b56758648bed18b2e4de40151348b8512251c0bb4cdd6a61904

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87cb2b238f9a3f284714ceb0f04c3e6133868d3b1b95edc0153f10a253f49d06
MD5 bb62c397d65679c6e935fdf7cc31dcfc
BLAKE2b-256 5d7dd42676799eba4bc7b87944166c516342fd8e63e5eda4ea4efa4f100712f6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2d93262c277b9c6251a03dffc5ac854fba48a281a4a659a2bc97e4ef3b1fb861
MD5 999d58a42c49339695ccd6d4f60b9f6a
BLAKE2b-256 e1d2ec5ea27a3c8de84bfe02daa779c57d5cc9eda578ed46048c3ebad1d1bd7c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a6eaa95583307c26c43c7d6d32ccc07ba5b52522acf9b61c95f5733b3b10bd4e
MD5 f21e7a1050ecf0818650f86c09364f62
BLAKE2b-256 d5ff43855026397158b4e99400f7c9de1584a282b0c2a420c8f1ca58e4f6b2eb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b089e1beb0752e4421f1a805b5a34dcd4c0179418a012f8d52271a523d3ecf51
MD5 5e42e4601889ed8d40db6241ea53e3dc
BLAKE2b-256 04258f4636ce8a6bf0bb4087575323a70f6f496f9d9605dec713a1e2c53c47eb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6591f7313ed3713a97dfbb29a810af0ff1fd950e8b94080a2d45774a26fc2866
MD5 81f38779e5da1f501d1b36a0f8ff1f0a
BLAKE2b-256 166c64a18f07a690bdd8cbc648daa696e4c68ef57ead7f8b831c0f65ebfb0fb5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8256890fd4113a7328faf7009653ba8c1950ada1d90e533ba594aa480d542ac
MD5 3dd2169a7903b0bb5bb3f3f281edbeb5
BLAKE2b-256 c5ad1aaf73c9f4b01dead9c1296a394b1e2dfb277a0485e60aefc6ee3d0baad7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.9.dev202407141720623864-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a41cb9073ed9d8267fcdb6537671c6bfa1fc33379b84514cb82a9b02a8f80d5d
MD5 6735f1a99d6e6c175dcc32ac1954353e
BLAKE2b-256 c99b84037281a9be27b024230bfc4364621f4035e1814a29736c6f5034016828

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