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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409211723794729-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.15.1.9.dev202409211723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 046229e76b05f46ae66815b02217e69458269280233269482c235c47dba00676
MD5 2888cfbe4469eecb5724fd457b0facc7
BLAKE2b-256 5e7c8e5d3d3ae250c6ee31b80ef144e79432fb2289f8f938609fec1d7e2f555a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 807c06a4d0b0ba2a5a85a123ea8c394809b2b61b07e0bdbfb6f788ade327f2aa
MD5 4de7d788b57d70aa3497b39199c8ebf7
BLAKE2b-256 18945259e63e0899fdc5edb0f13ea37ab523f0d9d090964905b2d11e6c875719

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2aad7bb8cd3ab7cdc6b3f2876375081e25df3d8e08c30ea70e5956e7ae3692ba
MD5 23bcc598e6ce8f228a6e1fb23e22b467
BLAKE2b-256 c72d4994eb583a0cb28857f2e412745d38c2ab1a44a90aa42b8d3f76f422c12a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6804507080937d8b75bcf084482b3eb2d0ca57f8f2309593283d6ff393867a00
MD5 de40e6207d0919d61b6d5d5f25c1af14
BLAKE2b-256 d2f49caf1d4f34639dc897608e69759df517f8751cd7cd0dde0d67dff211f60b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 95d94611efb4ebde58c4c649100690607ae7677d2b889f38b34d87c940be0198
MD5 bd229325d6881af1b0db5822ef555082
BLAKE2b-256 8428513ffaa617a801da14202b90b1da7e1f3b52822177d1b7fdd12a24370b1b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 823c60c68441502b8fd6dac10d04fb814b1a4263ffdc29e44e176af1394bc38f
MD5 8f6972ac07c3b2bd75c5751bb4b0fb91
BLAKE2b-256 466ab7f18209c67207f19e718df4f4a058def7a7d85ab65ee366132e64856314

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e6336822bd464c735618547c8915c86c11e500d83856a162b03285f710d450f3
MD5 5ec9ff74a4904e3af037fc9a078cdb02
BLAKE2b-256 32740860de8072f4d87a29bda30e47b6cecded279c7d4af2d17f8e2e5827721c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c18fbb1212cdca0eaf243626c92814ddd132394cdcceec64522de378d75f3a16
MD5 8ca40cdbe5dfc98a56b0e6f7f6aedbd2
BLAKE2b-256 1f041b8cfec6bc54990b3ad104315c2d206484af1605f512c5929211cba6da12

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3728ef58c0e9338e4b52e4200dd19797088bdc280f1c3f7f415d0bc1d25e58ef
MD5 fa315a869f8bc20444b7b8a24ddf156b
BLAKE2b-256 64e14a08ed14e63b2b934684f43d2f55806f982fc3fe24299d8686327af9d4bd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ca25955f8ace3049d7b556dd5ba1b463105394405288fd744f0b4134779b30d3
MD5 bafc81ba58c164735336f93417e07b6c
BLAKE2b-256 01ccbdf5d5386ff49a94cadbbe8aaebf71a133f1da29112e15e305731ee6b1c8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 96d2a2f16393798b154ab422cc47fca7ac42df4f6f8d290e894604edf84c30f5
MD5 be8ce3bba1f4740b1eb86ba63a749180
BLAKE2b-256 e87cc832e5140b3440283ee1ca2d4ed751026b1e239c392f3e0e76f13e1e2f41

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0dedfa48ac027054535331656143fdb04e6610dfa45477917326ce7398ad1980
MD5 cc14d0507c9ed3e142fdcab8a5a00e21
BLAKE2b-256 b965797127beb666f4882c2523b6eaf5848c7e4b44cb01c6f1cb0efc8e382c73

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 972135577d8c59a15b77d12bb3594144b730f92a89ab84f2747f06f4829cd0d3
MD5 8bb6b3c8323552a7408f27670c5f3f18
BLAKE2b-256 19beb38d26c99320f78d7a7419404bbd68587858251271521e4320b559bc4a5b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a4458b5dcadeb2bfb0b886e454bc70222895b1f190877150a9de44d7b6ecf28b
MD5 17c829d80e4283fba9c9f2a08fe1a881
BLAKE2b-256 0abdf034afa5b7b48dc5220db59521618abb07df187ce922734db98f907e389a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c2b1bae8988cb730ab6934570d5a4dcf9159daa793c5e85af04bef733b880ea0
MD5 57bddf98fbb3874616d565c189bebb3a
BLAKE2b-256 a7723a0837556639d81855dabc5e437d2279c17b62ef6f329b5239c742567894

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f03e5f9d34b065a05af6be0f9fb5b38def7f55159aedb813db20fb99ecc04829
MD5 ba8a4e7097838f386045315759f5f0d7
BLAKE2b-256 2526c11005e62fdd0283761f5dd873def50d25c69219d839b62c1e4df0d8d115

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 05fa46f394a0cb20cca800d86735965b68454ef22fdc86096bd2432cd6ef887a
MD5 df359923cf5aed287a57caee5c917bbd
BLAKE2b-256 6442c834fa463d33bbbb9a2337197d6197dceb4d3ccc67c6cbd99c7984625f01

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 70b8b3aa608784b417f6457d71b2a0d11fa5bba82ff3764331ff9d12f2c9c327
MD5 7002cac9e4b694bb8fd92dc790ce29a9
BLAKE2b-256 2a5f0691af379cab7d9667eadecda9543800b934d5d875d8c2bc341a713e4e89

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 925002ad58a85f4f2e903a3817484693d8fa720419876142a0e93978a118741a
MD5 d0778b1a2f2cd2134d8ae3fd32ffea7d
BLAKE2b-256 683a17d7a7d70629a747ac3ce9470e7c38f4c6bb9de3813c7c1663804a96aa26

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409211723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c532d68b876c7f6ab575cdfc1d940fb35bdf34b176bb47f31d147036d897012a
MD5 51eacfc5f81d13cb41b44f1d07c9ecd4
BLAKE2b-256 2bf3a82d1fc91dd40883847892a67e6adbdc05d1bae5ec9930c480d2214503cf

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