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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 85dd672dcbea4acb99127dd807d4dcd559d067650968ebe283a883150f50d0a9
MD5 d5ede68c7126dcc215eb80d94ba6388c
BLAKE2b-256 bef9f160ff3a2198622481df4535582cfd1335ac7feb10325f46ca1c5d2056c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 15f954071ae1bd24e8286c9b55289d5d200865771cd8ffea2456cc1950222139
MD5 22095650ef73cf7c1bc2a2921a2c3423
BLAKE2b-256 bedcb317273156a214e762632147a49f8b379aab4d977d4265341d63074e8e90

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b393fc190782d95af3540443e431c64b75ca7a383afeaeb3cf4aad1e6ec9796f
MD5 ce066c603d7d7958be1f3553aac775e3
BLAKE2b-256 d023dc7e4ee1308db5e1cf8fb75fc9323eaeb4a49a104e8bcb27d7ca13eb26cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f824f51f08f3d41b527e9872da18dcb381eb5d42fa4f4eea286014c06dc27931
MD5 13499b393ecbb3468fcb92fa645dc144
BLAKE2b-256 82a1413646c1230a99f5b50b28818368f13376ac7a9c5348301f812ed0611c41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4ee1991defcc4c7e470bc40d18e04b8f105ee11aaaab96abe3339e03dd2b0f80
MD5 7fb7a84195f80e0b7bbb4e0bc1b4a5e9
BLAKE2b-256 f6f0895c9c7d4359dbac13c40801f5e8ca5394a67ca143c20b38e43bc131f2d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6c081692fe06ca2292a02819a379ef834ce0816eacf50fecb5af923eed9d8369
MD5 15ac57b683b278386b17a22cf136961b
BLAKE2b-256 e28d13f73cc9d9e9b2afa95a6f93ff2d9242943d1d8ad7bf995514bd32424339

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 620b265fab57d959da75c9544a45f6dedf62053743b535f13047a27a4062939d
MD5 b2bba715725c787972a84463bc1c53e7
BLAKE2b-256 b2c2f9118572784bd6bdcd0d912a20c8d1a11f7daf8c5534fd98878e9ab0400c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f843993533b26416aadc83f81f09552383e8b938fec7e72575c26ec3e4a5bd9e
MD5 214088abb989a6633c5af31eee149be4
BLAKE2b-256 5e7e3ee1198d142dede491aa75929b043ef879d0486e8fdb216fe27a2a8dca24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 764193430bd0b541e4744d9e6352d9fc6332a5dfc14a01ea7af79656e3ddd029
MD5 179abe6c8fd53b63e52385e38ab9e157
BLAKE2b-256 9860ae718330523b4181379686d3d69dd5c1140e91c6f23fbb91f68362e2e831

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e9c744a56e5fdf74ed089bbe00e5993f502e1f45901c3ed7834f515bbdee7be2
MD5 ee9a5439a5578e42b077f4df60742431
BLAKE2b-256 0833ea585df3adff7eda4fa97fe16e604e6eea028a190d3576a5489c1b9f4d5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fc6b29a43884c4472f7bb1591818fbcf8aa20000a29ff000da5e45440c085030
MD5 e90f9435330aea23b331596ff15acea2
BLAKE2b-256 d2747a2e8a1c99a8c075f38cad4014aa5c2c04efd350535fd15ea26490257f38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 448c5a21691c19aa2d86f4a199212ff212f0150132023cea953510619abbd903
MD5 2ae48894a5e9205a7bd5c36ddccbe594
BLAKE2b-256 1d7771f105b2806478a06d7b414b7912fdce1742b201c91c363132258e1f66f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4d8ae4d9df6cb804cdee2e2ddbcffd844410ba4f8f799a8290425428d95ce974
MD5 f6a27bbfe6821714d4d92b4bf601f14b
BLAKE2b-256 853d91877ea0011b19729cb8abb37118e62cc92ca03406c43386f1754f388157

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 53cf424f8d748a0ddd59026e190b18c3ad11bff0ed51ded3da2bb68203def73c
MD5 7f820b3f43405efe14edbf274148f78c
BLAKE2b-256 a4a6a1bd07dcb34ddff23aec81b683067c890e0306c4cc66b98bb262cefc6433

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7f4df46ecd18f64d0bc2be4b5f600a6305bbb7030ba2d1ff0911b92d55081d52
MD5 a3f7cc9402f71edca530231987e799d5
BLAKE2b-256 9350fe8637eed296f08463a6571ce75eb350b767e23f10baf093bc139a81d124

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8fa10372b93a546448a1d2336b82c012928784a8bf11c7f5c26d087309b22831
MD5 92dba7b118e6c85b51bcf182882547f5
BLAKE2b-256 091a218ed3a419fbc6c5e99039b8593bb6d9e820a10cd1b33b6bfdf4b542f11c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 03429fe3614672ef12f6c29ff207c338f49d8edbf6a4cfabca04580f2f9489f0
MD5 01f7effb3a0838e5d6dce8cbcf661e85
BLAKE2b-256 10915183a6fd2399b8c8b70e245c190dec9d95c1194f591613680b935c31825e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9a947cd79136dbc0576df71377740c388fc773564f1d47c1eae964f2ca86dc3a
MD5 4f106944e178e244adb94b05356eeafb
BLAKE2b-256 53fb99832a3f140711751c05cda97ce1e92a44304df6a60859c0c508715dcb4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26cf3648ef09c34ed5ebc905cb227a9f7c5a56caac66fb3095ae8d7bae33b07f
MD5 d58bdca81d2944f37ebb5918d1301d4d
BLAKE2b-256 dbbe9edf7994bbbbb77549d0e6efb42e250130268176ced9f8893443c9f9ba46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501091731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 195bad500e93dd14f6382d652345b03cdc0e74dddaf156e47ae7789543b33256
MD5 b5b94bb8c7fd2fe97e3c818cb507d07e
BLAKE2b-256 622d5fc47b471cfb76055ae0fc4dbe5e224f6574c0914e7d53411c4cb59d3cca

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