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

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.1.dev202411161730930665-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411161730930665-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.1.dev202411161730930665-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411161730930665-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.1.dev202411161730930665-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411161730930665-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.1.dev202411161730930665-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411161730930665-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.1.dev202411161730930665-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 685566045fa9810d3b6a82fbccb9283d9286bf59e9285196a15608af1d79ab9e
MD5 d88e5061ad8c5ec3c8b1ccb494cb3207
BLAKE2b-256 e279f40c2e241b393d5862583cee905ea6a0ee705b4175fb5c5d5d652a6af74c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 538a65f4fa07f4a0fc230d84e4bd002ca74e8d98e29711988d46d2afca9d3fd6
MD5 2f13a94ef44f8332bf059976b8f8fc0f
BLAKE2b-256 df94f9621d5228a2cb8ba684ce0c978a01027cae6f6410b3072a1d3165bf4710

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 640262a3303085e2d7fe6e7e9c0d46cfa765a9dbf5b37c4b029a536629836fed
MD5 1e1069ab49cb165cb9608a0ce422b5ba
BLAKE2b-256 2de1c922e889d95a65fcc050d784fcf1efe01f4a561958aa94841bc5a3e9be35

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 40a7d8281536334d6b65fe160339fc366184c270936c3a926caa83d360a04a11
MD5 f0240ab2b9fb5f9799c8fce72720853d
BLAKE2b-256 5323ea453edfa4f57131a02edd7ed168fcf81f04028f41b95ecd8b5f293400ab

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 df5851917948aa6d357fc8410caeb76684969eae70f1becdbb56f6b5761cb99d
MD5 22f17db337631a5551ea64f60036c4d9
BLAKE2b-256 ef665a2b38853471a76d0fa9dbc2599d50b894ae8dfb1a756c090868712556d9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bd367f63506f14bd1bfffa62fc42d801f72ea19cb54794a3494032e061341680
MD5 be8854cb0a131394bcc3bbd2dab53e49
BLAKE2b-256 27f6f2d87905da0b8fb1f2c09a14628cfb22674419f85423774190e10bfbad2d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17d6ba6a24e803c29cdadad1853229b625f94718eaac4ecf2b9ed5c924ca34e1
MD5 17f4e236ed2e37a9496782150a04fdba
BLAKE2b-256 4f138f3024621506a15fd80cc0f9989861d50ddb6761fb124d8285ddc033878b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b2c81e3a1b641df0c22edfa237eb5cf648a48851d454b9a4e7007ec475a0c5fa
MD5 df0e6c4886800d3f247eee6f2ae029a6
BLAKE2b-256 4cd9419a7a95dd794073911a5e54f656c58dfdd3f623816619efd54cc73f6e48

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 240c45e80d62a8812a2ce48b4ea67f74772297e9f87841375fc30346cc6ea675
MD5 bbf7cb783dea31f4f5507c3e3101071e
BLAKE2b-256 8dd89e8700b9bef2b4511645ce44174879c0a53971cb25db6823c4fd35efbf8b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 384a900cb009607c365967fced7da7da9e2202e1ffc960de8df9217b7ec0c6c9
MD5 28b27ba9531fa5439e613d40e440fef1
BLAKE2b-256 9c67f3455f9af173958a86538d55877e702fcf23b95af92663c90fa3e24a16c0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6e7a55967ff2f3bfd55c5fe893e2fc2dadc02ecd02b827838810d55d7ef7f25c
MD5 8ae91136ef2b124bde62a81845c0c84b
BLAKE2b-256 a5bb4c7870895292c332261d083dc511bdeaee8944f94824b72a073043d08358

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88116f70c1c5ba57b8a948aa76977dd915e4e66221e4a70c37d08be25237fa87
MD5 fa4e0b2517223633e70387eca0449776
BLAKE2b-256 4d69e05fe4f7a5ebec62d93057bd2db861f875e7003a6f702359bf9e7f559f70

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bc9073351a1be4cf3880324834f4f331ed40ea56521bc497ada4572c98721875
MD5 2aedba3954d85bbff53640a9d8a6fed6
BLAKE2b-256 e211f6a73c81a0a385f30c417df6d5668aab9eedaaa61e37279f4b10372b76b1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 468e624ba0454ffda84b9725d6a1870d6a950ac5cfd01fabc984cb77c366e1e2
MD5 80e91c251cb1aafe689873b599026ef5
BLAKE2b-256 4945708401282aba51608fcbb49ff27adedd38be927e6a1a7c6781e7a4fff47c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2ad568b8c0dda9e57e72658c0d0c59da8615cfbc3eabe9452828669f8f1d25c9
MD5 da3773b409df13a0e41068a172228f90
BLAKE2b-256 25a920f08962e0c3225c8010118813f4081cccb9da07dc5ef021671ae0014266

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 52b8429d31dabce04d9d9952bdcb7f13271802bea44dcc976d8a5a0aac5fadd2
MD5 55ce280dd07ba58b9085e2d652aaf731
BLAKE2b-256 c5e413be68224bc781fedd503c6aaf3c030e5e5ad16914e997ec59400897df65

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 42c52ec5beab76153a8537dd7dc0f05411b7a7150efcd6d35214d5499d5e916b
MD5 35b25f2492177bbaa569d9063f91b5ef
BLAKE2b-256 04f5d8bdad9ed391c24776380b070035819d7d8cee817336bb4ded65483bc27e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4ea880ed37011c02c970d66c1c9077654f764f5a570a46c42e44a82a96c39477
MD5 f4ccd8c15e0ddcbaa95c6907bb8dfbe1
BLAKE2b-256 49323ff9306138607905e94603e4e6c12534d37c42858e8072520ae68962d4ef

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 73c799ecbc5ffb14b3649c570df4a847ad2f8b03bf80e3f38c19fcefc44fb1d8
MD5 516e403f1b14a2c3d2b006c517e7abf4
BLAKE2b-256 be248efa8c351c4a47aeab2ef16657e18a518cd12863c4239e24cde92f73266a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411161730930665-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 554f8e61e31fb94f5113ebbc2dac09d5310ad0fd08540efa5301a5f93e232ccd
MD5 db75f518b5ea81511527184c1aad5667
BLAKE2b-256 82e939b6a3e73f0c3a1836f028b61d7a770811ad6f559e04cef11a5f65b272b6

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