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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c47485ef2d7c1a980ff519f77afac55d2626f8b3926e773b7e8a1b08da11678a
MD5 52ae92e188571acc31f99257b7b91cf4
BLAKE2b-256 bed97c474219363b76d2960628ccb923f6c9fc865fe3d3e153aac28333608905

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0a1e9869172e2e5a1e48b379fe97df2ca0c68a9da1297a52e69dad5e23639c51
MD5 c06f1fe646d3520a935207eede23c2b8
BLAKE2b-256 b42b9725ace3294daf12ac5141c07927774edd5bfa1f3f16953bf35191a21259

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e7d53f5ae8e0c59b07340dd9b7ecc628ec00436b2f9162ba96de21e27de36c1a
MD5 3d533ae26aa5b336f8ad081aaeb2e114
BLAKE2b-256 68dfb1c356d780ffa97ee2def7f0805dc9904ef55ab8d1f4baf5d84742f03e5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8472725a7f56fa2531abcdc36e655c1a9595a592998eac6cb5354c734ad76e9f
MD5 ab113ac115a44847bad756c68edf39ed
BLAKE2b-256 a77d9685460b2c51aab8877ac0e8714735369c288049a591922810296e9a2008

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e7c75536352eaae483fa54e16a307ae6097df9ff7cb9791c9297d8237e58f352
MD5 130de3c4ff61a563bee71a9910afee3e
BLAKE2b-256 32bab35833e4197cb86ab3ebbc29d2db3095c00d7dc089c1f0860b739bba2483

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ba31b51d0322d70d30dcb18aa36ce8737072292fbda7969a496d8b098ecd8436
MD5 bfb5636cd95244e94caa150692d93e6d
BLAKE2b-256 0945ed9fe59a8888f8cbdf3d782ada00cc88721f39212c41ca879e38144395b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 420826306b5d8e7219f195154b499e84d4ef18cd66df8104f1ece431c7ee16be
MD5 3252986598b83fa15748a060addeb530
BLAKE2b-256 dae7a72d171a76a0f262c01eb96f85d1475d07ebecf06db922790155817f475d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 05077a878f54a4d38a714bf2a46c3ffd840004c5916993fcd0d2cf22098344d4
MD5 5bf1ca3effe447000cb8523c5e2f653a
BLAKE2b-256 5db96f341a244d15a5beae72bd9c2b313bc74085ea47166985871d7841636709

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 497ed0707928beae1e73e0b4f4a42ba8abef1dbd53ac3fa627cf1ca7f08caa15
MD5 6f2e545bceab4fe56fac8eb81512bef0
BLAKE2b-256 c1eef5477da64422174a728ae0b1305941177c018e54c732792983a5d89d6089

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f30933bfbcbbc3899e3d1f9e69750b4c9e44520d89dde3e340cbad81d625b436
MD5 539066dfd8d1a05f4d87bf4f76c7d5cd
BLAKE2b-256 2971ec037bfb14f33e42eee4f2cd669d4cbc432608f0c801a1a012500d891b0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f0768348fd31280591d6c42ff873c04bfac628fd3e8bd4f5fc80d25ea0346fb5
MD5 221bbdc56a91814d204f442d29e91dc8
BLAKE2b-256 6429a85c78f0edc1caf1bbc363ea394968d0671f3f0a8030b034401d8cf27742

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eec449b47455863b599a5347a8872366e3cebfd6ab8688ddf6434f7c28b024aa
MD5 07fd54e96e8a86456b9c3eddbb3dd86c
BLAKE2b-256 bf9763246ed4042ca823468311c3db9dd73ba3a30de0d7e81d5d648ce552e627

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ae3b616e90359751333547baba0639f972ffceade8e8c5a9f766b9e424c15c4a
MD5 2bcebcada6b12afe515b54e2c8b4e130
BLAKE2b-256 f6f9d04d1d7f8d68e828c5ace3def5395e064ecf4327587febe5a4d24dd0cdb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12fbdeaf3b6c059e86dc0656e65c4d91c0a5c71e83d1fb3b0c2e7504eb61b32f
MD5 e73c378905f8b296244a7799d6cd08e7
BLAKE2b-256 5f181403bbf2504fb908532d21fa8b43958c02439629d0c585e5a503c5444ef2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6313002978af4db0bfd8f77d7830fa38c4cefbb473f994eb17f6e40fe0b37798
MD5 2851282adb00a80e320b14c97ad1a305
BLAKE2b-256 024913b4fcddbb19f177e5285499a19b5c5c24a0f2248bd06d04d39b9301cd83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e9a66cdb8b3883992b02a190fac92782adb3ca47b454a5f5e02e29b8fe32d33f
MD5 063d1f126362ce9eea2de9003918e1ec
BLAKE2b-256 b362dc313ffef665d78ccc31fa165b26ed1ce28ff9f4f100f173d7fba49db9f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c56757f4bb11164d64e91e55a94d4a8e9793742233895713521577b1d40cdb30
MD5 2be5de16f198a48be208c5089ffe97d8
BLAKE2b-256 69f4f8ee13d16e04b328c3d04ca66cd35d3ae62b4114a26a92fce929c58bf622

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 008846db4ec7fbb59c3e3e6fd917c673b311cbb24524fa10e8224617d4ca3a36
MD5 15503aa266ddb7f855f19c58a13e7191
BLAKE2b-256 32f8b7ddbff2fdfa06253b565db04fc153d5fff1dacaac2b7890f5f55f31bbc8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 95a339ecf6adb7dd75fa5abb666df52a0d9581134611359360b0610c6389489d
MD5 159ff38f71d31266cc04e5d6917fa27f
BLAKE2b-256 b6c9f1df644ce1f1009c80649a08cf14b089415d70de25d1c12886fa44b9d344

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411251731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7a07390be2215084553706d9f2afcb8d85772724d13fa3c04494e47ca32d64d0
MD5 32af554662f51e2741c246132fca0e44
BLAKE2b-256 a1d2a8bae2681edd2f5d5039c49de6c55382b430a7a2e9749252a15433c5dacb

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