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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 016af0bfdc26fe310d2dcfa5565f677894b4115690fa9ff2e87dae69bdfdb0a3
MD5 1de589ff25fce6a440c8a61d6fcb0d0b
BLAKE2b-256 4dfce7cba1becc6a41a373aa7c724cba4cbb3d25628f509bccb99a18fae584e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5672757124e90e9fbf9a1d56185391e66b5dcae5fb17b6481d55714f221093a3
MD5 4cafbf439576a10ac96acf9a378e6c9b
BLAKE2b-256 16927e60f2e70e96a8ea33519993d92368cd8c64c9b7141ea4634343032abefb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 df62d8ad7e5d5a5e6196026d2999518a7ff316b600fd528b3c45bd86cd724888
MD5 a263406d6b3f8e8391910c54f9b2cba7
BLAKE2b-256 6aef7b8a41a55fe5a0d4d87e9fe7b464a03433bfa3f81a9c89376c84e82d2d06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 263bc6045bbcece4f8611958ba84352d36b8419ef4655d99d054e2dc7355cff6
MD5 9398481113c6dc4a0d4098d68985cf16
BLAKE2b-256 330af96f2cd5f6b28c8313339774998dd19f3caf7ddb599d24b3fb1814a22d1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6b4df321a4adf39fa328a6a0fd8d464ff5eba20424e1555cfdcb19c088497dfb
MD5 e1f30398187fdfeaa8ab82fbffe11faa
BLAKE2b-256 d31237c05cd73a914686ebb973f0eb759e1ac32f0577a9611eebe7ab9da2d2e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1fa6f16249ad3fd9eea60ba394e838d102cdf666469189901be171e8a8dd1b62
MD5 62dc25fdb2149809c81c133927b18299
BLAKE2b-256 d26e8ad2d9b411696c6dd6c3db5c9ef505839192f027814a488ef9fe83aae7ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94f95b0d24ee5cb3aaccdc09cae01157ef52cb48316546e53b68869e05c3c9bc
MD5 23305b337273461aee630975579f3d32
BLAKE2b-256 94a1c0d81e7087dfc9bd699f8f3cd650570314a46f1109ca13aed9467eebe02b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d628f13731f2e94572790378e34c093933d09391b7dbc0f18b1de592c68935fa
MD5 5aed1ad884882c4d505adf1da9e7df20
BLAKE2b-256 809da3c3b251b34ff312ffd6c7c376f09e1e11674c05520c9206fbc558e942e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c17b716ef4ec95c8bea5c248e06695a19f9d56dd52d8b8863019aa090aedc734
MD5 3f45b94ee5cf43a042c5495b3e754099
BLAKE2b-256 f03c2ec275618b3b93a324252355bb66fe5b1d9d40f5900ba1f900f3cb18afe4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 29a818e153e79f06765eac3186dbd9d0157f5de5ef228a13c8d054ba43b4b365
MD5 fecbd1dee4923440f4913645c76e039b
BLAKE2b-256 40e0669cfb8ce3c8c503c1a93378d2512b75ba4dcdda3087098ca76a64bcbfb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8ed0b654b6f41f591f6fab14f7e809419abad06ff6217a1ab4d38d7b094b3dc4
MD5 f5cd97b448d21fc603164474ef61ad16
BLAKE2b-256 3bb761df978ae4ffa35863ffd5ab4bf40c07258dd69d3cc8162b60591bef9c7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 edb4d2f7b1b0ee2f400f65805333da1009d9a1d0e7ff5883ca705cfdda233566
MD5 e9557a468b6f1dcd7e7da09e90c9233a
BLAKE2b-256 e3bbdc72e14d87113648b32e2734ddd175e553bd90837ca0079af632aeb2b757

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 79d5b315d74c66adc1df2864e3e1468f279951005fc319dbcc8a2e50f517de8e
MD5 77af5c9caa981300cd0036acf2a5353e
BLAKE2b-256 3502409c9c23c1a73a9b38300a5ddaf15f45c1d9db77be8f87406917566f94f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cadc4a57f3d232c5bdb368a5b044394385436ba4a428186ac09a6fa5ccdc534c
MD5 c89412fe9ee812a4437f8c7158260a4c
BLAKE2b-256 70ee9e3f0bde9ad37f83d8258bff9e0a0274cabdc374f08eef70b5032fa7f793

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 df9698000d2f4395fc0e7dc0b0c2ba7f309cc6627f409dca56ce18f8921e78e7
MD5 8bdec3571155652320feba40989a4f2a
BLAKE2b-256 0130977f50bf0e61bf644b3f562a568e1ce609fa91ec4d470fdccb1979cbc6b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 63064c39410a81afd677fc546ed0be216e75f7751b2947194dc70cb40f6516ae
MD5 5fef54f0a70f011a986cefb37622c16d
BLAKE2b-256 f194f4cbfc89d50e5b37dd17c20f78bda78796f27657b1ab1b9082fa8da0ed76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9952da97a0fe7b365694b6fae4c4cabfd7934c0816e4234bfed8faa31ba04486
MD5 87e80f73f643b2ca3f0e056808103da2
BLAKE2b-256 67bbb915cc65f25bf7b4611e2f699792b8674fc9e792d48ef92a72fbe64f3c2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1010f8bbc0ce6d76e6f09e713ab55fbc3fdf567c9931eb873474174b71565cad
MD5 7735970ff2e692ce12edb28d4770be11
BLAKE2b-256 8e8d09b39d59b72c26d865599fbfd69044a092179eb6fc0d7ab0bc28163a7462

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 948df2c81070aab74e28a2ee295c80a2b96762db7aecdc21ee6b050aaf9fce59
MD5 77e290e01adc43275ec21f851ae6a34f
BLAKE2b-256 5e65f779a60b12933fcbea7456506f3407f3e996dcb11de0732ad5beb2b07a6c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412231731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 78f869d6a732cb3c28b6ec9f9d6c8491942ed32bcaf68d418792bda5944c4458
MD5 f25a47d4ff52028d99bb83ee59fa85db
BLAKE2b-256 e9bc849c54b7432d6dc8de5808ee9d8521a95fa2b6dbef56002fe3c0b49469f5

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