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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9300672ece298985d99087947123afbe96afaeddc9ef16e8e5ba81a54f44fa63
MD5 24f11cf2cc89d9236a5c16fb0e26b3b4
BLAKE2b-256 d2e9f67d540491e749ad597b0d58c4304b0581b2fd11810ff029f2d56096e9a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 97e0c04767cc645770a5675b42af32bf3d088367b0374c41746c6f344a6bf8a9
MD5 28bacc2f2ad0c5b0b9c23b76288c8cfa
BLAKE2b-256 1cb029ed88c384a57c15b0f20aae2d168e7506fc1a11ae7d56cada9bb725e41d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0b366b4b92f44f6c1e81f275204fed77148d2263bfd010e7c770069cd814bd87
MD5 140dd6d98ecb280cb947c9fd52e9b21a
BLAKE2b-256 ade2a648d3eb4b757d68e9c25cc3d54c9208a7fca8832e500e37b7d5a206612f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ac33e84b5078c30219d54363d3c84dc9280fd44b5e5c9010523cbf31d34cf322
MD5 ca4393631dd11a468699794276087b35
BLAKE2b-256 510f1a5d97e93f33d55da7902825ef684c430767590f41dbc61a06f0755c82ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a8c230c94abab3642edda5403a417d27edcb71dbd24f894ed3c4e853cde68ce6
MD5 74ed17a15ef4b2bfd8e8295e96435054
BLAKE2b-256 124877ae24f7f95bdf16b22df8b4f0bfec6bc77e24f54973bae4f9668fe5881e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b7a2d1c5fda1a50be20befff9c53129a92bb15dfede7389f3654176e618e0aa7
MD5 713c8e81a8c810990757ebca861a8747
BLAKE2b-256 bdb45aec2689b36a0a7d8d8ae0fbe709497654e4829b2514d8a39a5a4c927437

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12c509e749c488bd2f0845ba7d6c7dfb7bd42f32ecd73528ec36df5d24322234
MD5 20633297693d1ee262f095d641255199
BLAKE2b-256 42553d645a523691b020b651a6766b4df3174100a3bce7f114b7a4ab3154c746

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 72c858b7878bffdcf0d870d9ac7f078ffd0d75f49de1c505d35374425522ee08
MD5 ce90ee36f4baf0bb6cad6b271d1ccb9a
BLAKE2b-256 26d727f4edc92b6f42e2bf255fdc5f5f44559871274198ded43e26b56cb3c0ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2cfa74ffde9c9c5e75c5fc8d7b2ace04d2743aa35873a880d4a1632d33a32b9
MD5 09096968c130ed9b6910341cc6d482a5
BLAKE2b-256 7dac519f454643e136d648a54714fc1c593183d5cb23ffb3ca43dc4b41fcdf60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e0fca96e9db618d278fcad14b01a392ebcd0ac798bf71a9d74f4e3fcb12963e2
MD5 f529982bb1f5ffa104012ee9d5a8fd89
BLAKE2b-256 70c2214d7db2b4ccaf4760f209937257d6319e59ec4fe349c1908b2f4c9da514

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 975a2e8ad0d40975c1aec4367b0002e187861534fe592d77d4102a6c04bcd237
MD5 b4950f34bbf7611462e09c97f4495777
BLAKE2b-256 6ebe3b30365ad1c15398bdb407dd0daacebaacb4d2667ce9d05f4de7892bc62e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d51bddd7e4ea21bbdfcc8ec155d898945a3be1e8f88c7cf1158523b4d10b7fb
MD5 a8e8f444e351c447333281337577d00a
BLAKE2b-256 501de51fb9bae9b842e66f16804160eb397307ac92543da8e2bae2850d071bd0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c417031f17117dd8c491121519337a5c482cfac28893942a3c37b8617e7fc5b0
MD5 eaa31ccce4c5f09c1de738dbafd72191
BLAKE2b-256 51ec455c103fc083285338c64a9d2e6aa1da818d793b47281ed22836e770f2db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2da07b7d6a7c4c5ca37752004c5f1d7e92ed52d6b7d22b1de1914a33ac7580e0
MD5 e6aa96582fa88fa0498b37029e98da66
BLAKE2b-256 4af7623c5e253d7a9dc5b295e8599a1f18e8514bb87e617ee135733cf89366c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e201803a989e95b1234ab74b3d6fc26fddea81c5b0f2d974f81430d9ef7ddd12
MD5 848e70b88a36b499e1c766c57bc20733
BLAKE2b-256 28a141dbb4f7c25c515bcd14a90ac6487d153f96fa0f5f0395207945082ad59a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 57202064cc23b6ae2f7cea751599228d53049e7bb1f79c33b52a2f33937b5ee8
MD5 92165030d98d432269b742c7b5cd3931
BLAKE2b-256 6b0758a277695f4f1e746f2f541b80c8ec2e52e81a3e62f9e6c460881025d44b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f89dcd9d92f4aef57013e164f4d63cd22762529a98d2c93d80b7b0455b3c07b0
MD5 c152def2f6f515d2bed48e911ffb9b69
BLAKE2b-256 03c42ca59a4dce2bfff86f9df2fee25302248ff72e776cb456645a1f7864af39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 348b1956e90002a85f4cfb31d9f3c36f7bad68883a05c79f2952dafe0fef4fbc
MD5 d7dac570a63ca8e16e9b7355f3f6fc2e
BLAKE2b-256 4aedb1df557a667c3cc3d207d974afee286ab8e0cae431800294b03175ca9a30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a357d36035f46f269f636f1560ca3b514515babaa34d56e8ab4f899f2f04b838
MD5 23ecf66cda9d2684f833f85835ac5877
BLAKE2b-256 479181469241dcb16e730f4a6c341bea82a9d0609adba324edbd0545e457cae4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501061731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7abf0214a5325f07005de9487b8fde2d1e1738e5b87b48edd8b2561fd99128d9
MD5 08b8c4f1dc8c53180a37ced42b67a31a
BLAKE2b-256 b3fad29ba1c1a6280b6aaa7359fbbcd7dad5433d3a82bda14fff0ffe85cbaa98

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