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

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 99e320d9b8b755a9fde25b43580d7d461e6f153360195f3601709d54a01be03e
MD5 cd5b0190136a27cc04ebdb19be888601
BLAKE2b-256 396d0ede961595e32c442003c885164f48b1d3290a4b4d3887f33826ac953be7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3739e08a77da13d26fbbd83355cd32f7433978bd03b325ca2e1fee551d178707
MD5 f5f1c36d2b72f0580374bcddc0551230
BLAKE2b-256 642f36caf5658abd280a8f5129a3ff854533395075c9c92e23e6abc8f0c05127

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 80e21c8bde26b5dc99c9aae32064526d3f3f32bc6e2f053989ef61db7578b37c
MD5 83c745a7cf1678df0ebcfe489c90c4ed
BLAKE2b-256 73c1eafb342d716d2966e2f0be90da1313690e2dbd18fadb15cc83eea39d0217

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 151cb61d58bb1dfec38fcf766e293d1c2096ac571e51db6a8ab904f80cc63ef2
MD5 465178b99484398264bd6430595b087f
BLAKE2b-256 8e2c50a00c20a73ce1ba5d249f70e6f11e7c9e735977c9a98ad8cbee56db3881

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d2dc51fc97bb202617a1cb618ba54284d8a8afc706904373a362d6970772b013
MD5 7e844edc14cb680f9f26f28bf6c7f105
BLAKE2b-256 0b7edf18b8b6b4bb608e47494bc14d3e10603fa12d67b3708756a7fab308898b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 886846bc28f0a1bc536f5d5146373ba527af088ed7a82cc360cb5405460b4072
MD5 00cde4321742388b74176fab7bc71f8a
BLAKE2b-256 8b766b9ed8f5be6ff89c7b9ece6042c0dd05bf610fe066aa94dd0d45d5135d8c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 86475844a5bed7ff73e53d0c331ff292b2a41d15cb1c85b6b1f959fa5ebfe4be
MD5 6967f21e8cd74e855bd68ac7ae3e7a40
BLAKE2b-256 cca0266dbcba4426d6f057ae851a1f89d6ffa7dfa0403f3d052ed6b0707263d6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cddbb527c359f2facbde56e075ee0cee7622349202c46f5980c940057c20b906
MD5 45efe238bcd89412ec3e5be0223c78ce
BLAKE2b-256 692c27c3b0ed86b35c0a0d08837363a1f29e9bfb8c4f963d67f5971b6cddcc1a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5738d4a3f92fb6c2df981d135c4b2347cf450df68334a540fc1acb329e1e0437
MD5 db88be368cf2a19ebf475073db7cdec5
BLAKE2b-256 3eb7afd2f6495b42cca27163e603d763bbe08e53a303421acd5ea807f1b8af3e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 51284c67056f762de231d757c8b3190ed1c2483d35c46b3295c2ade5f04e5e6a
MD5 e98b2f0496219c11ea2c623f4a9a17f9
BLAKE2b-256 5da1f879e357a6b2b99a1b6bba1076d46b93d3a2c4a7344688d01acad478b4b9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fc4042e0306088c180b32dbcfaeb4471995fa8fdd106eb6427da29ca5e8f2631
MD5 c6fb52b81169455f765f440bf030703d
BLAKE2b-256 0c076f3035303b7ffd6a9f76c6f07dd58dfb38b72ec2f4c141fbcd955f8c2409

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2a30b426b4844b0415746287ed7bca00ad2821a28122883dacec48e5d585ac6a
MD5 683170dde3f01a6940985576a09675c7
BLAKE2b-256 b651e0edc77fae27ad83a7890fc8382aa118e69e6bcdc228cc4a47b9fc02071e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2e39ad59b20ddc48d9985c1c868648c9a11eb515a8220b03f595e4d9abd34ef0
MD5 1139eeb16f08f071fbff808c532ce22c
BLAKE2b-256 8133f9fd00481561465558d83142e440a8bb6608c006a41ea5d5d0fbed557dec

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 753bb5a5477bac43f8b3bbd0e3ddfe2dcba28007e9eeb875410c62352dece8aa
MD5 84c9c21c0328bb4d6021a2b45e17f043
BLAKE2b-256 c92220db10b6ef985de3bc42e65bdbfb6372e17eeb19d55496eaa9e7e34a2dbe

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6af30a25183129aac1a3cefae4cd8820769e22ab70ea46f4504b298a4480ba4d
MD5 aebfd057ee4f6f2f6112ff0fab07a235
BLAKE2b-256 bddc1c75d3e8202375e1f90bf2cab3ac7d2839c09970c5f2a77173e964d59058

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ee5da13253863becd18efdf89b94d11c763e8b16144bf315e270f4f5473beed4
MD5 8ea5ec6dde2568289572ec7bb73529ca
BLAKE2b-256 7b260fe91277f205851bcbcf04015e5bb7aed270ac6e5664f7e6ec25260ab641

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c76ace5992c785def37710dd392f62c83c2a5a1f71225b4593e53df1e29081d
MD5 34de7cc55911984b8eba71f8711cd7dd
BLAKE2b-256 cda003a15d1a7d7172aee92ae7e6d4e3203e55960f06d91f4e4c467add087e36

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9a3b862615688765adbd49c8e531c09d3f1f53f727bf400a117e558cf6aeb522
MD5 5352f125559bfd84868c2f7b9e48dac5
BLAKE2b-256 4f383c3dd7ff4b1efc2e533dda2d6f71acaaa53565c38f9e4adb2c810a5c833d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e7654a1dc6676c29858ad180b252d0eb4dc07288e00516e7000f33f61c8282f2
MD5 0911a414f7a1688c611f9c0e4d16136a
BLAKE2b-256 bf315131800f83ab8942ddc7d031eefc94a796a22669abfeee38a606841ad09b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407241721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ff713019b38578044a4383f06edad5d8e89ad27e78959f6254c48fdd5f5a62fc
MD5 65b1a67b675d683753da2436dfcca64d
BLAKE2b-256 2d3f6abbb24cad0a663b3a274940a35d7cb512525db12085f001e38b8fd13556

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