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.11.0.9.dev202402021701813464-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 be9ebedb5ed6471074aeb2be22d32ba2b314f3b7872a5f3500ee36be8dd8fe44
MD5 7766d3129d78c7b319ce599674f7d0cd
BLAKE2b-256 c02ea513fba5ea6bc8a6fe6f54c1dc8cdb946881062e145c83afcc6a5b20f37f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 114239126543f8390942bd18409454cd4ed8d7c26c9829f8c2bff48b24d18de4
MD5 7c64b5c78920a5dc777a5f97a8d32bdd
BLAKE2b-256 58ed7155058e87697cb8946a7669249052335eb8725fe933a9f6e51dea4dfd48

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d7725e20cfbfc2b1bbac233786ff5c8b93d2f5245e543243167713e8ff85ec31
MD5 4abad8c8253ff83439f21591339599c6
BLAKE2b-256 34309b5a233624df8320f1a9cda3147a1c2b2124dbbd6e245e659490c04565c1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57203815ac2bad617faf975da72fc6e76ffb355f6d0dce38ec8ead4c95526897
MD5 74e7b52281ac34abd7db7c379cc8f0cf
BLAKE2b-256 ea96320897bf8830c58ca68150812f1a68e90d71cbac2cee6e359dbe25a514d8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 af177b89a9af40dec3709fc03991123373376f26660cf6e8ceccf56603615626
MD5 ec03a58447136bf87b9760d1a56a6bf6
BLAKE2b-256 6fcfc64379ed405ef02dd974020d69e30ac6a52ad7d6c8f95fa00bf0a3f3c4bb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ead46df866c0912b19f3ab4e68713c3fc886b8e45e401fa1facbc9d478181561
MD5 9bf82907a15bdd59cb82e36b68c0b04f
BLAKE2b-256 722b62692d0ce610d5090404e2d5b8d7c3e8ca7236a7db23285e07b2378dd089

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bdf870fe49226fdb3e08aed6f17a4ee34b2a087c1682cd9f049c9a08b465b21e
MD5 c3ae35950f2bdd30308265dc509bf94a
BLAKE2b-256 85102795c1b4b11832ec4066d4fcd276b9f642e8ac4dce779a5f04e0e4b82149

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 380f9ebfe8f843316999dc388234414e5ef7c0810c7e5a458d852c8348c2b75b
MD5 b75d0e73a4ca1b742f8fb3050d77aaba
BLAKE2b-256 3bf158b8f37dd13d0bd0ca54bfa643ede9968bb421d1ada33337d2362a5a6910

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d60c68fb4790579e3bd5b7c97cb9dca65c3250456322c6aabc7e5481aa56cde8
MD5 0d96819dfcf426ad14d561fdbacfef30
BLAKE2b-256 fb1c000e59819c23538bdee34e1df35c2aeb728a5ca1bd9831fec12bb714063e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3afc7fb089ddd2171b11c80b6ade9ce548b3c4b111bde768e2db291b330bd969
MD5 1c70ed2e4fc01220c229e1e954f27674
BLAKE2b-256 055404496acd5c1f80691c6be2c243092dd393a07065d71fc42be7d5ec172f75

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7191ca5515a4a35a32fa8df1b27395bb71c31bdef61f651358d2bca2a418abb1
MD5 01ff330e42ff8cc0b76b7fed913ee5b2
BLAKE2b-256 831138b56cc23837dda7e4fc27b68b406a2967eca93013796408fb0258316c00

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ee6aa544a842e4ffbc6ebe584dce874fae6c9f43b2a4053e15296e0c35939bec
MD5 91666598a50844c681a6f86460ecd854
BLAKE2b-256 f6fe1d0ca1ae6495c27d02fe5343d6be90a2a614c36d3f47aa9af57dde238279

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0057cabcee6fd2f2e1c688e56417b6df9b74ea3238f11e920892bfc5250f26c7
MD5 cb80bc30df41358a4622629fd46a1055
BLAKE2b-256 70096c68cabdc97e41381f3275b0e258345fb1dde70d63b07d183a80ab57faa8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7e8b52b5bf6c12407d44b1925e4756d5fedd645e589fcc3017c2a50bec541f9c
MD5 45fe7dbbcebec7bf72807a4e5946d1cb
BLAKE2b-256 83526cbd262577b9ed93165db22fd902a0b7b863781a03b7739fa4e6ef1712db

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1ad172ad33bc848d1d6dba9f29fa112504eeaff58bb4faa369de227e7d82c30d
MD5 32784f6152edbc154a34d8908121d48c
BLAKE2b-256 586468f067226ab73f91c5d35bdb23921d9595d39bcf7113cbdfb048ea268e1d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 56b60c8d498e01c0ce953f07ebcd35c0d2898faddb885df8bfc4c866b2a9d67f
MD5 bcf452c2a613353bfcdf84353ea40426
BLAKE2b-256 8c26d7e0c55aa284a692086e5085d0892c07211fa898353957dbc4bc133de39b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b3825b22a930f1f6e086bc29a6a2b60f6edce8f4e963a71a14a6846663b0b4b9
MD5 efb8a3dcc73d25d0e905b8896cf838ca
BLAKE2b-256 dd16331dac39a0d834f9d9f24d08768559bcd281f6f2368ab66181a9f3fb8f95

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7a2eccd6df68c28629effcc43e8f02c7dcafc9d8a254891c18594e5ef4240c17
MD5 08c27a1640b52738ebe31f611ebe35f7
BLAKE2b-256 4f9dc5f402d64c1a3a4c166136f594b0490b712285c197dd45c156b0bbad3ecd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b8834242f397ec0aa6d37a08685077dbd5e3bf8aebc6a0fa1508071e1a875aa
MD5 bebc36d39009f3323ff74e57a80c218e
BLAKE2b-256 2b029612f1d8cdc2bd4ab059b66abeb3ecb9fe2e9a27720776c314eaa90ca50a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b27fe17e63438b45cd9f837cc4f195c625b88d4a6fea1e0996ba9d99bf13d1c6
MD5 ad7944b811da146c4f3b2d5062bf595a
BLAKE2b-256 e528e0b69d847b6453055e3becb83679b48e57ac789c6c5b77c36495cf0dd9d9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 96cd3e66f10d038686afeb6a1b215046a7e231c6ede3b932b507986ce692300b
MD5 597f56ee654c3ca6b5831445d7804ebc
BLAKE2b-256 0ddd0a0928c85aeb7e756a0c9ee6bf4920b2d24a6844b975ed5b807f332604dc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 83e3cba7549dd35b560a76015b836be63c3aa38fa7710fab087c80b4a7252b63
MD5 260edcbaf6b07bac733c63d0737a44b3
BLAKE2b-256 6a9ed2d4d741625b8937be4fe5319c485c9eb965c61a453f5598dae70266f5b8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6830430622bbd1954b857f07be172317d30fc0a3f413b2554e79c913ce510ac6
MD5 3a6bd751dfd2e47eea70a4a4c27281a7
BLAKE2b-256 7e9f3266e1188538568f1742654d2cdf9e254441e5d8875d72d7fc589e756044

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 10d43f96d7913c47e7871aa8b484d39ebb71b1f34203ce741f383f12cff71ba2
MD5 cd9da4fdd48dd06a64174be2a355f3b9
BLAKE2b-256 0f77177961e7196e4311d01cdd632034115d43cf959ad7f64c2557e5dcc5a909

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.11.0.9.dev202402021701813464-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0a79a39004d30841ddf35f7d3e3f2122f7c0deba7b639780f2f1434da981898e
MD5 97e1360ed42efc07bc1f8185efd4262b
BLAKE2b-256 7a8d27da2b63173e6d42da8c21b115482a94ac0c6122332c14302881cd8f7e6e

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