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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408201723794729-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.dev202408201723794729-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.dev202408201723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408201723794729-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.dev202408201723794729-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.dev202408201723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408201723794729-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.dev202408201723794729-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.dev202408201723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d069e454ae0a8a2955ee0a9d30c109a8de159d534646df0c47077538a03e9b74
MD5 44a9b52e70f34d289f62820821773cf3
BLAKE2b-256 dfb866d5b76bf647b33b4f0af9b16f0cfd4e33d2c5c0ba284eab48e9853b0b64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e44f54414160d5d1952c8e0cf600f56eee74df7d62adc9f4c1ca3cea28f286d6
MD5 ac14b5b4eff95bd227d02eb3e80606ec
BLAKE2b-256 fd27c96fd0bc64c80c0711bd84ec3be3ff232d942756d66109c1a1af9dc26918

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bb5cc42ec6822313b0a4ddff1a8f36c9a81bb5c6bc9197e4b2d70fc5ca050264
MD5 9e52fd72af6cd4fccacad85a6b9ee375
BLAKE2b-256 ab5e37d7e2051079bb9b3007a418b2a68be07b26af0119d97e57cf39f7443022

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 54acb400f7e5a9bed781b1afe68b0ad164a71d5aadcc8534b952487caa9de766
MD5 8745ec8c2f842079bae54dc0b478bc90
BLAKE2b-256 3e3efa81f5825c619df2c5332402ea38ecd5678f60a3ea8ecf6462eefc2d1439

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b2871863df8dcb78e4784bd86834aa605a6b0451ea8db5aca72c9dbc35cac9ee
MD5 8c61ac77850a6d7941f168849cfb114c
BLAKE2b-256 9aa08f963854e6a37865bb6d258f2ca82daf010a90cb834aaa31f4e1817ea179

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1dbeb610b5beccf990f2de3d0e3aecb0bdb79afdaeede7958c17d92c6d85e6a6
MD5 432457e7da5212012a47e852df028c0d
BLAKE2b-256 7a51ff690b70cf8497e2ab339564d7cefcbcb2070fc50aebfe76303f34e3ef3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2a57d503d40b6cb89a237a010be494d07e9ba8678c2488d0b4a138363c33796
MD5 b64a123d0e0e6681a49467d0b49d3e68
BLAKE2b-256 ac853441d43bdb1b9db04f4e078720262b12c3692e39ddbc33d92b966e5249f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3f88e230cb0914ea355ad34db3e911024355702280c6567dc9ad9b90b0b63f55
MD5 86052af0b8c54b29a4320a2dd248c4ca
BLAKE2b-256 7eaa88ecec1d6d65289bbb18438a639baa0a722f1c7b0a9bd15c0067cac7f9f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a6c41d4d2a137437ea0c9aa96ee83cce1cdb981b0e468a2a23d66c8935742e76
MD5 f10a50b7c63e4e298c463f9910edb157
BLAKE2b-256 b320332bafcde0f141a6a951ab8cacd5637616c7fa1d75672b6e3acdeeaf2cb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 05e039569038b1815b4180a0eeb715da65296a02b999599e40f582998d534323
MD5 ba0e095bdfac4c8d52a9b50a05e8d5b5
BLAKE2b-256 cb9daf7e3ee44a6b2d58b8b98ed248e4121daf6e37be0b67b3a97ff685717fa2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7fa42a7440ccef3be0a6cbe0d59c178bbf5d17bc6ffae7a0c5ce51bc950fa0c7
MD5 63bcd842ed44844936b09b7fa7dfb05d
BLAKE2b-256 996dfae76344a537fad6099c8808d9a0775349770603a7b5b1240072b1e846b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dd36f524243c7b47840d10db182a17333b772ffff759b960c2451a3ff0c9f707
MD5 b5f96346b20100c2667e5694c554defb
BLAKE2b-256 4f6ca3f46dfb8e71ffd8d1f28b566091a9d3a89fdf67a70d5129daa26689ead9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d32d5b933f1a1afb40f4de289d2609667f77bff2ad56a16044c3407de2437ae2
MD5 f1df2db3d9662f1a427498ed99b74613
BLAKE2b-256 3f44b09d70c63bc72cb6644d5d1372a50d5b9881138a83eff99ad22bdcc7a210

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 47421417a4a7ee1d944b1ccf2ac0238ea99b627cae4ebad7ba3ca373cba2181e
MD5 1ec47c54580aaa2b5d7aae60bafb1276
BLAKE2b-256 01e62a01a2a99b0bb10811a304e61d246fe8c77355974e923fe5f433a001b4eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 36b181c1872f2d4fdd242711e7a50d432edbd4a4275048ab8a5cb633897d860f
MD5 f84784971f547f33b9db13efb48c5b8f
BLAKE2b-256 597a8e289e0d99e04c17955c9b5f2eb1d01a3399272c418661ab75c175ef25d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6265da7e357b72261456b21c0b2baf59b9c4ced28a14d3e9680d04b8d0e88f61
MD5 9b8737427cab5c0b2e00ddb73cf0d766
BLAKE2b-256 a7e6caf2c66bf39a33e238a7905c50774d66dc44d0b2a4d05089d9a9adef5378

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af6e002e02cd184fc01d3037ed99f081a4faa9101f80c3fca7878525734ba356
MD5 86b571fe55704847d6d72d8e027482fc
BLAKE2b-256 3de5831a4aa9ad12a691b43741973044b3a94673fbc3585b6e87721ca4018022

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0fcabd7a7ae1f724d3857847e376eea42dc1481e0a7f0d1317b18a132e82659a
MD5 c52883c7211ca4684493c8b8eb6fadb8
BLAKE2b-256 c7b0f049bc2fd692d3d2b4f9b8a2f7f99e4b035d0db561ca49d56e637c5784ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e3bf9abc7668863a0cea555150227aa21e4187f9d95f3e28eb40d6280aea568
MD5 96af65e1b95cde3eb098ff04b80da7e7
BLAKE2b-256 c36a31a99fe79a9b00fe499c2f9e8b41b7a36eca4eeecd479a4727b36c062837

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408201723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 22ffb22dbb00047e309e17fdf58e8a7354e3023bb50f554671f6ee1f9160813a
MD5 3da61cad392264912ecb9d72f4438aea
BLAKE2b-256 cfea73b5e856a8b7840c8f888406ca4869f982294e914c6b54c32c4f993a3891

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