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,2023 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

pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-macosx_10_9_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fdae552fb0b922aada7b60aec565c48ead1d1a9293f1254aadfe8155020254f1
MD5 319098609a5a89ef300c6bc492aa8b88
BLAKE2b-256 318b0dfea8071c4251fbd559382ca259c2a8a00ea26e4a28c7ff1544a0fa39c5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fec60f10899914288483ef69f26e3c808da7eb80600d902f487820e3faf21e74
MD5 4371efb459252b27ecfb7b1d854247e1
BLAKE2b-256 68c5a959e82de12655f2c63a93f4dda7409c6b7384a2f7eab4137e46914d7fd3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a14eba89dcf719e017a5366f322126c99a9d9f3a29ea5da708abdb9182af2c80
MD5 49f27678d89ab112bd31c95148de9b1f
BLAKE2b-256 321bc57ce5be049b9b17a5c74e4731a11f80c7fe8459a354fd032d02ab6f50dd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 90732671632b69817ef911467ae8e859226f3987dcf99c2371ee72dcca3a195b
MD5 3f1325c4c8d5aff88c051b613e29b7b2
BLAKE2b-256 a8e874ecd87c084fd32a72e8a6280df8545fb520306a3daf19cc6e79db40ed17

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2c7413bb7a6e0a8d162726927c8a2df0a631c8993dadb03b9816e15fd42aef7c
MD5 2d00eb990e012b2dfcc33a5c7de5329c
BLAKE2b-256 a062d53af8a6da654f37c5564179864075cc1afacf94b9004f65b8f1715d4edc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3c9707f0d4e8d10bb68458693fce863902617a014218a801b1fd89129f1876f8
MD5 53fee5ca03faf78e6bdb9af83fd3d816
BLAKE2b-256 9f8b0d0cd5a52efb7008f40ec5c1998f41d3f23a985a2f4085dccc222fa5e731

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f7ddb75eb59f916ffa0435cd0b524920771d84dfbadb184e6b601a9ccb197ba8
MD5 e8ebb36869284c66d1742137000f972d
BLAKE2b-256 8bb2eb8b1f38e4a75f6195fd58d02b81e9444cc70919516feb72f961da85a536

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 78e83ee6f2f380110bf428df9c0bf8cc05aa4d9d5ba961711ca78a4923a3fff8
MD5 36e41ea9c56443c7b8ab0b7371fbf5e9
BLAKE2b-256 e5547d82440c40320a168bd1d6674a07486817b601f3387172a4caea3da32bc8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75a442ad770494e8fc6acebf58b485b8b63e8aff979157580c3cf48de835fc91
MD5 e460781e72e20a1956354d542e7bde23
BLAKE2b-256 f7e771abfc24a1ba658d78aa1915e6cb05a829cdcf2ef1cb3cfdad52fd7f5609

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 220f60bc7362418eccc252531d1c9a223a609cc00b0aa6440bb1c65617f6cb2b
MD5 27d6e4c6ce1fd768394e88fc14c79240
BLAKE2b-256 81876ca4cf86428171dbc5f3749ea75a21030a814047f5b80970122576ee2cf6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 111cbc1d7734201c109832c29e8e1c6bccbb1b957f7bf8ab98877bffb3d08dd9
MD5 d12e6bf1649ea850ce52c2f0b3278f1d
BLAKE2b-256 6e516d7b7e9a892e9f2c3b5af7cfd155911d090d614ab0161df739acaf89830b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1054e1dac8adbdde6a8fbda095629f959f8a7db45bc186b40e111b644ff8a326
MD5 ca06c7821585ae843eaabcd67f54d9d5
BLAKE2b-256 a321ffdd982e586ee2b7eff688c5e31238a029ff9545c0a38ed726268c6bbe94

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7461b21d7866feac827c60c6af8e1eac174900ec4dbc1bf023818012378080fa
MD5 b2f9a992734676d09355eeec2a3bec38
BLAKE2b-256 209b5b214394510363d2cb70ba60dd4b78187e245e0c4643f8635f6d88fe1f26

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0821db30bd3770303170b15dce675998c11b4fda77745c7d74a70c52655cf51f
MD5 24174bfa7350e0aad936079200c2b61a
BLAKE2b-256 6cfb5bef30dfb1cc2eaa78ab2b21a7ce765b57f53c7c6b916ad49ac221cdc3ff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5b103b5e3b338b4c2c43d79088a1c5afb2eb9a8ed74662cd851c99110b4545aa
MD5 4e607d388e07ca26a510a19f819f235b
BLAKE2b-256 c0339f7685128c225bbe1d7083aecbb0ef702a00faa7fe2a8e23de40136077b1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4f399d78cb7200d43fbdc9035fb63b4bd56bca3ba8d08828a09ae752a92213f7
MD5 45cb80358c155f9516596b1dc5986b65
BLAKE2b-256 ff8011e259a933589ea4de03b9857c1be62e74148873122288e826c95483954c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 765e9647bade650c2702e8395b2aaef8f4b2c79100f993c515c8629df015252b
MD5 edb6f2eefd7d087b132db317ada972ed
BLAKE2b-256 55a88147bbb855bfe58ed798b9a57e0c186d807f3676788f83340c78c9843caf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b537f79f4af8157846aeffaf903ea9700ecce2c74ef226bad752a6eef2ec08d5
MD5 88d66918523ad50ed9fb6ae0fa3971ea
BLAKE2b-256 c53fab81d294147408388295d8d1a860cc04c6cbecc218deb42acea22f744f07

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83e348d7380cbdf64b907c5d4af922af099e27b4d9d9eda75669411e995fbaa1
MD5 fd0b1c863f413c7b547d6fcc9183bb65
BLAKE2b-256 533556c427165269e7bb16b8e0420d1bdf05f5297aa6dbb0938c9eff1b1296a3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 374d735dbfcb7b082627f9c727d5ec7f6489dcfffb6441383035a6089bbfd61d
MD5 b6549f9d2f7253288214ee8c851cae7b
BLAKE2b-256 487fc8208dc058cd7d2017e58accdf4283d3a769b35f86f6ed6cefc8cddf423f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9d3c266ac1435cd883bff88a4fa89e2f6c4ee1782afda39eab5bb32ce2137c85
MD5 7fa4ad58797b6a22f19e83b407686b51
BLAKE2b-256 c1be1028ab6bd0b6f7026bb81be935f75a3ed797cfba74f97e9ba7dd7ce4fa45

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 67c0b86539286af84ec839e746859ee9b09b0906968d71a05e80085dfd728d43
MD5 361fbb8ad671ce309b2be394491e68eb
BLAKE2b-256 e0d4b334338f30509d50ca9e5834e8c60042afe89a7e9ce27e5e84c7f014933b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e7d6a9bc38daefcfdc75e37e6278069e1d0cb8d452c81eb848927c1b36296a5e
MD5 3992bf0773a1b10b904c3207bec2b08d
BLAKE2b-256 9a96184ecf84b95333a2e713bfb3134e89a93f15a07d3e1cecb7ba65652ebd1b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a17229aa7cbb40d2373cf0101cb75764f0448d56ed6ff826b4837e4f4e7dac1d
MD5 70fb5572dd8b0fc7726b7531290403a4
BLAKE2b-256 20bf462334a1bd231033b9e4f8f8062cc16c84aa475dafd3e5b70a45b6f254b3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.0.dev202402141707820181-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4bb31e2965b4a5853f4aa4fe15fdc662ac6cf828dec5eca9a179d7a5a5c7bad9
MD5 306835867413c4fa7375c3ff51e7616a
BLAKE2b-256 0d5f758c86070a267c472719a995a7b40fa9139bcb5ba0e91f6b5a91bce1dda7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page