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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501051731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202501051731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501051731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202501051731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501051731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202501051731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501051731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202501051731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 53f58d8e6f8f1423fafd0f5fdfe75a45f7726f0bc008ae555e6de684e20ee6ff
MD5 3bf501f15dec2e2c1aa09661e5e39978
BLAKE2b-256 11c0b45f7c15ce58eb26245c4e3ac25e3e588642442b00bdc6230ba8aadabffa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2e7a5e294e1257f673418d685b1a6aae9f28959f45fdba88a6edd235e5f84323
MD5 a115c74d6b9604f0ffc2130f08b0acc1
BLAKE2b-256 9aa42cb0a75e821ff6149da25087585c1af0183ccdb7a9cfc73696d06a5e4f56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2ce79884d3bdfb8ee58bc8b36d1d4a5a8c9d18dbe62b761285f39bbc5eb42048
MD5 49df7b1b1875a104336ba4b2890ee3e3
BLAKE2b-256 468ed372e15be7576cd0fe2c3ed74aed70f691c1dcdefd31059086cfa61426d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a1adb4ed05ea31440e94a1a9dd0f9567b08acfa55e23f672e3655aa61c9473e
MD5 9b5e3e906496ba9aa7bac82d0f86b09f
BLAKE2b-256 353475c0096e85c794c368804733ab2cd63b1f230196328df7946dd168fba018

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 5e0870f8694c01c6c9d58307166704355c45088fd1b92bd19adba2873ea49bff
MD5 449f3fa531ddb935a04f2e9afce2183f
BLAKE2b-256 8a877a4b18043488c3373345b9b0972f0a19e1e49f5a784c02e7728a0976af29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b87a0489961004543111a971fef7d958c279ec6667db82fbb376f1a2c6fa94d2
MD5 a43a84a532b2114eb43feebce61e3ea0
BLAKE2b-256 2c4e39cbdf16a350a2b6e507eb30f82d0bddea221364f28e018faf4a432d03fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fbb935f998b7381059cbd4fb89b97092b68ad4888b8fc5b99dddce0ab6018740
MD5 47f82900a4ca8912ac1202a245c0ced8
BLAKE2b-256 4f185f774129354c4d5a0442577b6d6afd15b5f474fb76e86bddcf62b84530ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e2b6aaa023d5e59f9df87d0a79bc27df7252947c0a6c9df86f2e8065ba8ceb45
MD5 18813be5d3d3aa5faa81f92100cdc806
BLAKE2b-256 4f4dc818355290e250d4b8a5718f2a648b511951fcbd13bf9aa730704d06c709

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed7483c8d1b003e9a95605051dcca2f34cb946ba3ae4f17461285f7020d5efb3
MD5 eb9acd8ae2bd6068cbfd21bfaa354d0e
BLAKE2b-256 678753a179bfa457f1b8a36d001e4ffba29cc0ab6fa7c570c4d5c361f390b7a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 332bc2f2803a43a200d03f7e74b45ba6a954111e11b548673ca23ad5aa2fe8b2
MD5 381bb4919d1d0f91337b2c265c192a3b
BLAKE2b-256 01e62f58b8f4f6548b47a725611deb08dc60fef3f821f7871f10668fe2f527c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 feed4b1aa101b29ad2eaa8403f19d6967f1200db5923ac16525cccbbd458e2f8
MD5 f8d969b848a0fc7008868ef9414c4829
BLAKE2b-256 04e87e180a46b1750fb8ecd449524bdffa2f8b6cd3133d645fd9743e7f51dffb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab80cca40d877362b205701a2943943d12484ed0b3ba13af6f806fc96a7fe79d
MD5 ee59b156e34e9abe786a177eff16fbe8
BLAKE2b-256 cb2caff29fe736a08e5f692f2d5724e423f02c1e40e9bbbdc82875515aa26b28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 35a252fc19d63f4b52f52c41c41139f3cb785c73c7a3f9006d0f5b9e718955c7
MD5 fc732d4092fa4a22c35bfcc79bc19202
BLAKE2b-256 0b8caae24a855ddd6bb18192f897571850aaeb09d771d1c880db1c56be43a08d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5336ba8e5eb9076dea0b16b2deb0a59b809abbdebb1de6a00404dba2bfc5d3c1
MD5 21eb440e60534d9fc2b28c2f4cd92cf7
BLAKE2b-256 acf0f702fc611d4c6f9c1a5da76bb02e4ac9d5065435fec777f36c50f5468a34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bd88344a60f2b228c23a3eac0c5b534f714bc3dda4b2a9f0284a981bfee8b36a
MD5 a0becdb8d00876fd64965b186e2cba3e
BLAKE2b-256 66fa43af65e97e0d224be214c26899ef0a9cb64b67bf9b1c839fb19ca6ef6c06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7d1b29f189f3820af6895ab759e239359e34cbd018de295cc3c55ff4211aa5f3
MD5 480a0cb8258dbfa03ea5ef84f61d577d
BLAKE2b-256 e5d600512b8c1034529052d2389a0f64597ed011ea635c893be0974b956e243e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1cfaa9344600745464c9848a77f31ed45d55234b533c41c0146c506fea10ba22
MD5 3df8dca947b6998d46c2d4f0eadba26c
BLAKE2b-256 9760c590ac05746b09f419613b7f234c7bceec0f93b3ae4a52b78926c3e77d7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d1b0679ee2759cb64fd88020ebc9a56699a806e542548fed690bacbe6d3f8fe5
MD5 fa23085de8188af77dfb55c1f82140b1
BLAKE2b-256 d337795043a9409be5d5736b61d9e5cd9e4e5c54bccfeb4faf585d8eb92641b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 694f03a9224c6458ef1eafca109b1280c11903d1d6c6cabb4710dc8595c15c27
MD5 faf768bb75067100f3cd3d78853e9246
BLAKE2b-256 cd991891d0dcd0c9a1fd2629de3c0cd57e1515417f67e976db086627b3208432

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501051731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aaca8df1133fcad775b55bf5679307000c727b55e4399101a46f7cd7fb6bf420
MD5 9b947b192a2af01edfea7175e51e1220
BLAKE2b-256 e04a42fb618a504f19b476bcd0dc14ffc4900bb42052c87d1b841b49c54f0f36

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