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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.1.dev202406251719262276-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.dev202406251719262276-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.dev202406251719262276-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.dev202406251719262276-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.dev202406251719262276-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.dev202406251719262276-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.dev202406251719262276-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.1.dev202406251719262276-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.dev202406251719262276-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2bf9ffe60f46b87e4e3131034257934247bf234ae457dff459762eb10a4ea5e8
MD5 64dc6e7de65f8ee0661175d105e45abe
BLAKE2b-256 c366018c961cb73ee21955d6bbe2cf0ed58561e474feae66feab1fa0b3bab799

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d0c8e0be4da40799ba863a56bbbc8efc34e5d6290088668815fc3c77c3d8e58f
MD5 52d6d3bece3b6a4ff24aca360901c44e
BLAKE2b-256 239656d723ae226e5bf9a92c5ca52f1da2817343abfeb77fbefc37638284e150

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 13879dbb96f7bd81707bd9f57f015050beb3b839a2e69cbab4a4857971764294
MD5 4cf0a05d3605c4eea3ff82a0836186e8
BLAKE2b-256 862a13922565956f5cdf4218b231dffc7d925ddb90a6b02578fad95378b0e646

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 400286aa7437625465cceb797eebeeb2e24385d55324bf1c881277e557406480
MD5 9c6c516a80383de86d00a0c3d197f780
BLAKE2b-256 d91d848a8d6acad2fff5f1394815ddeeb9accfef7d5ce85d0c56b0a799565c81

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 854c739dbc543d7557309e44d70c47bca88e7dbb5bc50f52552cfecda314d315
MD5 de3f9be1cfaf9e7bef83fee09fd4f336
BLAKE2b-256 04837514fe7dfeb6078129713cdc3148e0950ccb7a9fed7eb573e8dc2dc8081e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ddffc09af224ffe6341c17aad32bf766310c303bb4b31b509531668447aadb6e
MD5 7fca3c88dfed472fd9b36209a9bf583c
BLAKE2b-256 355262a79b0b83ede284d481b5d9bb348d7d2dc7481ab7d1667277efa09bfe87

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c5e233c1984d33e86394a12bff5b46053d35a8347d42ee7f91d3a502fcd4233c
MD5 6459be34c41d3719cc8cbb525e7f1c8b
BLAKE2b-256 a786fcc3d38a54323310a451ceddc37e426c7e9dabc2b041868527d028decacf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2ed0e54526a2eacaeef272858dbf52e6eeb888d284b63df78c41757534443bcb
MD5 f8a0465ab5c564cf5e724fd8273e4fb7
BLAKE2b-256 9398acf14a648617ef8ce02b3b37024c5453957262c28994005711e9a7aa6d7c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6798043f01c8a2b1cac8070c18e146df5eab540f9c89d7980d011abfdd2a2b6b
MD5 4279e948ae8b2154009e438e8aa4ddb9
BLAKE2b-256 fd77c57e98f0ca1f6995393d964bd60dcd1eabca435b44cf655237f0c8b36b98

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7366d69d3d358ce6caf45ba4798c69b0987345447ce96e894b796a1f66b4ab17
MD5 fb9c4deab8781c05eff8c6f345ce6d8b
BLAKE2b-256 4b562d468be2a88ed1177ee232fbe309e780523ca15614eccaa742280474030c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3bd66320ab061195cbb64fbf7b99602d0d0404ef65a238d4442aa9f57f80adfd
MD5 665e7e7697e2dc4e2af5114a619bb73d
BLAKE2b-256 cf5203f29bc63c302ca4168331aa5fd2c64d1b4a67b0c57a82ff010d0fdedbf4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9bf84c92255846166f340363cf0e6d5d0f9ed42c1a118d85caabc613776956f4
MD5 fd27be355815e1c7979b3a5d650cbd40
BLAKE2b-256 82a271d305b4f539700e7e9dc2547ce932971eafaf9accc30ea10ee36612af22

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fd4f3eada1eb2944e7d3de863e14008a509af6c2a7f9927228971f6eca8dde64
MD5 37c2489017300d6d4f5098611c1373f3
BLAKE2b-256 f0249bb65660be23873b4f78e4a9aa47cba5f88b2144b6b623604ae8b60042be

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a9ed38b558e01b5f27275b5103ce6e85583be9c98faadb29add3a30ed574ae3
MD5 3eec30e5845cd68dc26cb999e4e6c6d4
BLAKE2b-256 30788d5dcd0d5f46ab76caefce8f0230f56307f5c06821230b449a17ab76d4ef

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1389e32c19f2715c201f0a15843126539f6aece4c7371e60ef9c6b31061a140e
MD5 33d3c12489cca6150efe9b7a7101f767
BLAKE2b-256 f0189422b8dcc160bb502eaf7f5c81e0291ea3e29c8c46d87f38e9c8627db79c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0662253342f3f5a2535b434af0b64f2ba36b65bacfbd52046129d828434a2811
MD5 281804056125b4a7796e2a436a6b98f7
BLAKE2b-256 a15ccf50a62975295e0f60b4bcf13d9de115c7ad79028ddd0c763d800c25d8ba

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 05ed5bdf6c8e88454f3fd330e4d8c88e3c4836b8f09eb8d18df30a5e5a5a8e47
MD5 f47cb14fa6e0f7bbe8c3068b1b64e533
BLAKE2b-256 9551dabd2b597326eba2951ac204bdfb18d3246b5d789e27a5a5a7a7e60a0e73

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5f63bc4b24a8f0ee0fa8d446d9fe3545b041cb47babf74613f9d81db2fb398b2
MD5 ecd0892b688c2377618df062f9cc2d16
BLAKE2b-256 045f902d0f3981cc49c1675152c643edc40775e371724e4f6eea610b71c4fc5d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e62f8c1851a0987a7891394a75ad5bee2b90ddc64829f8cc13fa87c03f107790
MD5 9dc1274b13783586d62924a6df60a322
BLAKE2b-256 2473d446d978cf62bec24d90712b0e02a88cf7642edaaed04734833b9e62aa17

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.1.dev202406251719262276-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 933197eeafcb91b32a414c2accd464f233335d0c88d781697ad5c676732c2939
MD5 7121b7b35e60d36cbeb13c04da069bc9
BLAKE2b-256 00011f682c362dc9a4107fc0b9f8738403eacd8014ffcc8330351af76c06c8e9

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