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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411231731932516-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.dev202411231731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411231731932516-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.dev202411231731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411231731932516-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.dev202411231731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202411231731932516-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.dev202411231731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8f08a0b644b39f99bf094cbc4c8302c8b5d0781280d2fd9eb029645717a54b0e
MD5 b6d8858eb9d92a4a44243774b048cfec
BLAKE2b-256 3e68afca3a85c6a6af8a77175e216f7792318a8508cfbc41e42ed42a227b3f9c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 44d7305e14522692d1437c0568736825f968ba40a30f5445cc1c687614685c49
MD5 0d97ae773727a92c66fc7998427b2512
BLAKE2b-256 90be155726dad0519a62c19959d62d93adff3af41a2861eec9482cd22e8e085b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3429fb108cd64b9abe5fa2086dbef234f860b397632ea1d5fea36e1426dafe33
MD5 b36bf7aeaa02211602293ba7a1a1aa74
BLAKE2b-256 ee9a81db3c005cba02e6580c6a07d442ef48caec2bacd13b85e45e2ef3bf6a6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4c6959295b94cba61acff29b476f5db1e8e3c0f5bfad97bdb9c88f2ff23e75a
MD5 772e0b4b560bce1989783ab90979a83f
BLAKE2b-256 1ccab167b95136c15f561ef5f6cf7f4de98dd3d39cfefeffb313d6b22a595ef0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 372743bd2e9c63e07a35956970b4bc14e54e755e4d35a5d187860c11e204c8b6
MD5 992eff8a1b8f61791bafeff303137ee4
BLAKE2b-256 d30063129469e1587babdabb4a5cfeceb6c6c98cc634dbe0e9a2476e5a4dfd5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5b13d4bfd361e5aa3305f4536f4bb365ab94984bb00ba0d778273da49e3b2df0
MD5 cc7b28743dd3825b1c0a3925009f1230
BLAKE2b-256 d1926d1c6c97c9af3a27347152596b41eea36159256d4fd97eb0330f5c44392f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 393e2405643aafd07e8135146a8e8c1721f0539a3cf9120d8344e62bca5d0776
MD5 f7c032f351264fa9cef071339f5af42e
BLAKE2b-256 846355972e3208745d2ba128e511f7a8c6fa5f4c2619a20f7448445becf57452

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 429daa67b1d78ff12650ef5343de94e5226608c8d5b46319fa6b07352cb89f2b
MD5 d4c03f17f6fcb6bda393c328b2d4a937
BLAKE2b-256 1a31bc935e06df99aa6793f230145e984ee1774c55f8017bc425fe5561f0c447

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7ff2c420bc2d90a7d6ae6be266e05f5e4abcd059b66a23585391edf775df4cef
MD5 5088cb9d036721ab212db4657ac5ea67
BLAKE2b-256 4d813c9ad69e2fb404e4ae2432d17d4c3b1c7524799bd20f34d63862323e9080

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8a2f9541023d4451ba651820e4d0e16e9f73e298fcea8f5a87c2cbfbd844e5ad
MD5 7ce0d810837462ad70ab7433da98430c
BLAKE2b-256 e2cce926df75860926466e6cb55d9397529d8e14788e8180c87cd7bfb2d09d33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7f6e619526fc755647787d59a1440011eb2f3f913748085b2a53dcefdf324e37
MD5 2748d485f78f1df5fb26848c6613574c
BLAKE2b-256 47f2b1e14d68ea0119851b19483d8522369782c738330acc9c748de756548a92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f053fd830e702ee629640169c6eafcfed7db439edda5a5111148806df79c3de3
MD5 25ee71ae15ea23a0ecbee855e341b98a
BLAKE2b-256 5e29aab3575d97a47ff8ffc05825b8e65633df463f89e009ca5d75cc8bc0d594

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8394a0e07b6df6ae8f8794333794356f6c051e2a064c37bd17fb913084586682
MD5 e4e7fdde4a40d755393dbc3ab65bb363
BLAKE2b-256 3cf3e09ad67a5fd27103433861075f1c3fd4f3a5107110de798a261fb3468347

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 727558c91ca4daacbace146863c0459b1b3d9d7973c35ae6d24621a35ab6cdac
MD5 9e27f1b7f724b65b010d555aa508b03d
BLAKE2b-256 14605ab311685b7ab0514d3be4e3d55d8a0f03a9f66a28ddfefec9dc4ede0952

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 67474dbb60ea5135d6512e82193f1c231b54702ed135d9ee089c23261b66b992
MD5 d3d4367d95ac54ed3ef883a220e1b286
BLAKE2b-256 f7033c0cfc8374fb9163adc412cd7c0b928154665d1887c4b397bbeda4033071

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 46f20584d6aa95c24792f4d1fa11c1154c62f51e3f78f23e74e67f6ca76ecfe7
MD5 365928e10b2e3abd2166e78535444850
BLAKE2b-256 8d6bf0c17ad955b9f37192f45cfd1fa5da448c4aad05bb17b5c476a97b148fd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ab166ad2ffdf4f61cf5d24be3e51cfb84a9d30c81d05748cf5788b1f890548d
MD5 01d6372fc8ca86c65c1643b0648eb329
BLAKE2b-256 a1b0bfa03d928d6ee11c20cbbf171a759d83fcfe42a9d0aeed53b11154e4badc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c929b156891cad76a39c5dfe53efd88e42f18f91d717a065ddcc622fd79483c6
MD5 3ef8be588a4f058f7b89411914bba401
BLAKE2b-256 e71ad04a7344d6c84151ad9aebc8001d68a28ccdba7889d078328be2be3ed257

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 260d31b9b1c85011d3908a72946c60dddbc6c8e1403d32df4786b2ad343cdb07
MD5 a187b7c37544c588d5bd07db1d5ea3ba
BLAKE2b-256 f62c8c8e4c77b473d017fb85aa7c349935d4f9c230d5846aa3412a5696b11df8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411231731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 107ec567ef190c8647b1d901e915ce7b4303610b0946c0f621f3fa2c5d8701f7
MD5 5c9afef93e062d957d63265cd73a7f1e
BLAKE2b-256 d4efe014c0849895d118f92810af15fffd536072333a1726a9391bd05ba50e42

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