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

Uploaded CPython 3.13Windows x86-64

pyAgrum-1.17.0-cp313-cp313-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.13

pyAgrum-1.17.0-cp313-cp313-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.13

pyAgrum-1.17.0-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum-1.17.0-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum-1.17.0-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum-1.17.0-cp312-cp312-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.12

pyAgrum-1.17.0-cp312-cp312-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.12

pyAgrum-1.17.0-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum-1.17.0-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum-1.17.0-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum-1.17.0-cp311-cp311-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.11

pyAgrum-1.17.0-cp311-cp311-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.11

pyAgrum-1.17.0-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum-1.17.0-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum-1.17.0-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum-1.17.0-cp310-cp310-manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.10

pyAgrum-1.17.0-cp310-cp310-manylinux2014_aarch64.whl (5.5 MB view details)

Uploaded CPython 3.10

pyAgrum-1.17.0-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum-1.17.0-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-1.17.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pyAgrum-1.17.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for pyAgrum-1.17.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9ad7887ac6b628d7b2e7c112d4fcc4b913641fccb99e5e66bfa06749d076252a
MD5 a33041bd5f0cee7d2979dc36f6d4a07c
BLAKE2b-256 1b4e9fdea3b92b215b21c34d14bdba4594de2d936580256f38844503dbc59d3a

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 69537809be18121f87aaa12d58c3f25a05f6572deba29b2982d3289829c746c6
MD5 28162fe381bf5911137987d1824aa7a6
BLAKE2b-256 6a4d054c777b63aca7b61a37914e12f055014a4422835bb650f839cae52f5e90

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 03dce44e043a664d3ed517169b00be32cfb8535ac303dc4211e73a846401d5ac
MD5 de1cf6b6c3269eb6a38521fc4a107204
BLAKE2b-256 f606922e001fa1a66648eb9503142cadd745ee564ce2005cc49ef23d910ed01b

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4d6b52cc38c31c97f01acd8353393c35c7a51d13ca8a14dfcb0db9b7fcc8e01b
MD5 4b775e77f09c07a25333d7efef6dabb5
BLAKE2b-256 9834189e446cd16840d3db58a68172114cae5d74e3601edeacb1f3086d6d55c1

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 599437c81e6120cffd0d46a6d369d66254fa5fb2dc6d3428446e8aa52d912398
MD5 7c7f89b5470e11f35206b5b533ba4cc8
BLAKE2b-256 bd5b7c110ebfd45b76bb07ba510053c6ced7f7ae7ba58bafae9c706279af97ae

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pyAgrum-1.17.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for pyAgrum-1.17.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 27b1246d002b19242681ef51cf058a729a6c442970b358986402f84be7eb1364
MD5 c2e689dfa30065cf9155d0e6afa636b5
BLAKE2b-256 f27d6351ffdf765575d2d955d9e593db82cf330cfc2c65a4cf43421d111a6ba2

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 62ef0da68f87a94ed783c35715811db67eb1a4a8c3530d7375dc38ea3e727003
MD5 7aee37e902a047e0b08c37b1fb09f056
BLAKE2b-256 576b9a5335a6fbc8acbace7a428ef5a7ce2a9e90c05e60588d08f9940de87be2

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2796d3118b93d2daffa551d4b0e8754138a03d28ccd14294918adfe813e4171c
MD5 aa8bbca185ba0ecfaf96131b79de1a50
BLAKE2b-256 e2872e8c6181f0ad687838ab97bf386d015ca5a4d8c128595d140b119d325b8d

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d7b0d42bf8ca96af733652362727f33cbcdb32afb697443537b0632452478606
MD5 11356cbf5842e7c38f87fb8cff543c26
BLAKE2b-256 10c0a83ba982c1a0d7fccc64a98abfc937ea9e4109473d4fdb5c624808f712ca

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7751765a6061b7d613198c31ed5ea4de89f3306c639b23fd367ff4cf24ef0ea6
MD5 1bea8c9c0dba13e0ae5f4a1f1d56ce52
BLAKE2b-256 e99b999d77796fe446e07b72a97016e8b1d7afea097049680ed56b84a6317976

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pyAgrum-1.17.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for pyAgrum-1.17.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1b698da86a137a63cf0b38430c39d88672990a8d28e1085740db32c958297039
MD5 4b713ddf73b1569a5af78886377a6cfa
BLAKE2b-256 24719832a426b65072bf0ab38eb756556a7aa404eba722e7aee5c53fa8d9ca94

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dbfe5cd2279ab22c2d258de527d232886014a0cfa946ce5199b138f1fcdf8bcc
MD5 7ab236551d687dca291536cd316419d8
BLAKE2b-256 e7395f3ba4669ef0f21aa05fb14dc83a24163b98ccd46ba22cd3a5c71fc04159

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1dcd4d7db444087ec429e21797b527e35cc8a78489bcb374954ee1b49e6082e8
MD5 9f6c87aec3e32e62585d3d1e941219e0
BLAKE2b-256 c4f0558ed2090616b50a89e358da4319d3da3d6227d6d075a91c07b3ee6b68d6

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3575b5369d79047fead5e37b4b092c5f024d999df3f59801b5a61bfcc3ed9fe4
MD5 a51a7c4f9a0a51fe24c42de5a9213243
BLAKE2b-256 1bfae9951d3f88bbdf4bf73e08af812f82ed814c28ee7971c95b5bc9f9f147e5

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9c2d4880660340a6a4ca10af816646cb1e5245941a52cb85b9fea455c527bd09
MD5 1f98180cca8f698cd5687445da29c312
BLAKE2b-256 d413b543f6a1df76c7e725a12ca97e6bb9d3b11e90adebb89ff05bffa5fc3181

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pyAgrum-1.17.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for pyAgrum-1.17.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bd7cf0316ae3692f34bff9a3e3733dbb2a41d560ffe72d35ca33b0dedf05513f
MD5 1c2adb2ac23b87de853fd388d47aac17
BLAKE2b-256 b354bbf31acae8569de379a42103a2a81989a896dc4ccd66ffb3a97103e984d2

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 36c7c512fc32c503afdde7a84c28a6b09d97a06c89271c9ac4854efa0b8af98e
MD5 5e0fe1f042a3d8f6e3a3f3b794af7221
BLAKE2b-256 f3a8a4e385b1e58e3bfd391bd66229dd26e4f6cad33f6508479571864f5ff173

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a3191a3781d1a619ef3a47ba21518fd8369f0a32f869d95596fbcc1fc6f7ef15
MD5 c804d03f87fd9b1f40de1afa2492bd00
BLAKE2b-256 d280970d65735afbe16c177fcd738a597aca6c5bd3e5bb94a320608cf37aa3a3

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a1056baf6ccbecf91224b9b2acd7092e18713bf1da8adc470cce45f07a037bc
MD5 6f08af5ce274efd0b97c9cb23ffe2d4d
BLAKE2b-256 9634108543e76a0580544b0f8957af09c81416c06c3c5d497afe3c215820d12c

See more details on using hashes here.

File details

Details for the file pyAgrum-1.17.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum-1.17.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f026eace812d43acc022a5617b2bd7aae90d6150ecd967f2d3d86e007a9db4d9
MD5 57cb72b71210c776f43975fed1f9f55c
BLAKE2b-256 8b6dcaca8d5b2a9c7471e4595644918d21bb14dfd17d1575f35cdb3800f870ea

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