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,2023 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.12.1.9.dev202403051709650834-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-macosx_10_9_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e76594546362356e6b60ac8dc83b8c043070750eed716d0cd23ef5d064b4d600
MD5 b9a492dd749afa194ad571b25ae5a199
BLAKE2b-256 32ccaf07502921732466e206ddc8b2639b9b1b4e0bd8d369fd750208bf8396bf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d29fb3c87e2d1595350f26d856765ee08762807d4736d55a30daefc6205de63
MD5 1190dd849c3bd1af8b7738b3a8642ca2
BLAKE2b-256 36c2deb0df12177776d6ec469a54645967a23590df7aafe1cd8bcad8e7c11818

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 36fe29f838bd0d744255a058096c13bc36f566725aa8b31422de6ae780f0bce9
MD5 b31ff2e01f2f424c0837569ba7976d51
BLAKE2b-256 23b44aab06797b4edcdf0a34444523243ef2db850e2aef7d315471ae45062577

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5268da4cecac0433e8aa298452b669daf9bd0144704aadc550ea332ceed14149
MD5 c4b269e1983fb4891916e9783a8cac4f
BLAKE2b-256 a83b4ff583c49327c954d4bf27dc5d991491a7744d5214cd019b69e21551a70a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 91071417d8295a9efd7f9fba4b2d8fa9687656f0176eb316457cd0e2bb586d4b
MD5 29a16a342d2d31b0cd87f06d793a6a69
BLAKE2b-256 0f83b3fe4a702e27758b73f99693448c49e6f83b1cdfbbc04772c1300ec73fb7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 63571e503a08d3d9795d04ead06fa7021da7a80b85c8f179ee98f047d5db9fa9
MD5 13d16d96b6e35521ca84ac1009c88829
BLAKE2b-256 8b079579168be905402c68fc13b7c30097edf2a39adc846a9f11820381d5ae9a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a9ae0c40e8caf87375a16b5886fcce2d40948d6bb2afeecce90db138b9b8a24
MD5 9b3b3ec1222ded716c79fbc5e8dafd70
BLAKE2b-256 f9da75f10ff1cfe82c80a4ed5eaece3f0ad5a411b8d555750289d302e975e154

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b97d4d709d4eaf7cce725d315d8ec2824bb00e53ccd195ecdbcce31299ae3ad1
MD5 1b90f118ca287344c0fc341aed022ac9
BLAKE2b-256 fbbfdc5d9025ea008a28fa6c57e4b8ff62b05108ef800a10d12c6bd1441e2550

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8eefbc856be51bc3fb6d4ec18211cf8ac299179e12f9052b279d8fe94b0ba968
MD5 d0dd91f3bff28f7f156c3e7fba58ed84
BLAKE2b-256 6860a21789f4ea6b4af1a17c8f50922f4e0dd6e6417807b2872ca5077d84a1f1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ace501405c0da581f3bb22883f5ca8eead6c968f3c636827401d957fa4247e45
MD5 f7d86b74bbab13331c30838024dedc71
BLAKE2b-256 bee0e54dbef1ab409c0f1becb933d5c63a08ecb564c58155d7dd6f0c48bdf566

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8219caae8ddd33277a72e54b3b13586ac442c9d7404860fe2f20e713e62ab407
MD5 6219a231f74b441b6c08c3e2a28900e4
BLAKE2b-256 60f51e80376a4adaf11356b1880f3a4ce5be6247796887def4bde6fe1734f363

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 044bfa34289ee91f4e916c9edddbd1f8335ec40ec416530e45c7ced0a8f456d9
MD5 37476cd6283a61b730a913df114ed786
BLAKE2b-256 43b7ec73df90f23dab501ce9b39eb29f6239f4dc7154f5bf74517663b35c0fa7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0a16f3d26d48f90ddd90a3c82e923ab384858d323022b02e98b17dc93b197f86
MD5 b0685f602bf31b70e96c6eac41ad26af
BLAKE2b-256 3cb11124cdab95af9900f7f8c60f1c64216c931ff31fcf276d148026c9371654

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b914009ce0b612b74016854f92cbe6bdc62b577b6469845e32dc6eb8cd63d06e
MD5 f887a2ddec7e03c94a291e288d7d2ac5
BLAKE2b-256 f068c118783e79e8fdb2842717bcc97c0ab232e996552be44a1d05809364abbe

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3548cdc32bb2a45eb2eacf1f1c73b6c0032df2be7dc40d86cdc8c8f7c4cd0af7
MD5 5fdfc72fae3a5394f7014099e8984da8
BLAKE2b-256 4a58fdacc61bf655ec779eafe54151a785ba7cbdf5e121a22b2413f301aaa29e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1191f1b214bd14d3bc388c2d7a10a91d5e7f59a4cd19677b5e9a4477f88d6209
MD5 a24bf2c4764712e48adbecce78b8f5b6
BLAKE2b-256 a3c9beda7de1ea6554c40db07e693b4a8f9c6e45af4f14d290f492c93f8e3ef1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2778fb86c834ed079276407605eb8c4360c0acf48044763c1d613301ef90a24f
MD5 612d24c5248632918311a8d5e3064031
BLAKE2b-256 dff958edecbc987aafd30226c4e99b13891fdef97766fdadaf25bf22d1dcfc38

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fd56b9ad800ab8b70af58677fd671718109cf9a0fbffbd98308872bbd4f8161a
MD5 b47c7aae2116d8ac5d7d69a09f852357
BLAKE2b-256 1e20578ee3d3321507efb3d1edd2955af4c447fc8974bf1cae441d84902bfc26

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3524e39e5b4f58f54840d26ec2d0f400d053f447f4dfe3e0c0ce0705a2469433
MD5 b3ea3777e726af27b5f26cc07469533b
BLAKE2b-256 10ee867cd17c7192a2a71a0138dc73f763dd8107793f296c93d727b72439c9a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f4557b04b6957bb43efa6c33bb951100ddc3c235d5bdc956dd28a07f81920bd6
MD5 deafce11b1ff5069fa8e793d46070b16
BLAKE2b-256 e0eb0f16b77d7bd96c685e2de03015942796e68e8fcb1087f2f3de7d8f00876b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 02c7e2afc562272853885984ca71c98a3ef26248cf4b1840f54955b94a3c9406
MD5 e48a6c642a4bfc6afa25179ffd194a48
BLAKE2b-256 ea9948cb58b0717f38f541ee561d4a147a9e89587f630ec3fc7f8db363d4b990

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9478af43479d6ece6fbd0409da3fa70631e1e2ffad9a1da9cc1eb1def09e5e4a
MD5 4c04ab2b18618f03f184fa089176b194
BLAKE2b-256 6e01729e2a19114a2a7fa111579899fbea2b72407b45c8de30e45864e968ff88

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0e00bc547280f937056f23746a6094be99bec1fd2e22e3eae1f7cdcf7cf8822d
MD5 c934297283c0d25ebb2430d6828bfb29
BLAKE2b-256 0b4892e2a5e0c1e02ba6fad98e56d77e06f126892bca389768aa031254a58cff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 067836c81787fd23d59ce55aacabbc83f76901416f88b80f0491f90bd72aabc5
MD5 f32be6b2ee753627be134925566e8b0d
BLAKE2b-256 2f95840f90427ba070b4c5a7c72be432342ed7e507fba0f3b5041b771182c22b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403051709650834-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0494e62e7d81983740470034f2defb6b292aa2826c0098ac714af7803ab3bfd1
MD5 7f846f62d71cc2f91f9c732aaae6568c
BLAKE2b-256 72feb5ae2f965649d336f126797afca2b9608ae45b789a3782ec8c4b5cc36ad5

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