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.15.1.9.dev202409181723794729-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 90a1a801c981f273a975515f8cdabe4d01d4366e1c37c579afb5b0d6e682e241
MD5 72b13d224936515de4a141b414792dee
BLAKE2b-256 58c324158a59125da7414ef226909743797847cc4a9b0b02200f04495e9bb4dc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a3e2b29c3a0204bd48453209a693cdd251f6f4d6cda10295778e887c42a7c84a
MD5 887b5d1309ce21d2b04e5e69086a6c3d
BLAKE2b-256 2acf5015742815b8db7b6b539582c419f40813c93f59c11c0b3f4d62da3df832

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3f20145eddf0c59f8b221a1d1af4677ecae7d705c30b05fecb7cec8ac5cc3e4e
MD5 9f3497e170d23135426c7be2f94cb65b
BLAKE2b-256 3426bc556a4d2db1474e5ae7e3a3361ffda051c73084757d730a60c3cc2df4e0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 198eadcb235bb79d6628de5673db68d82ea915c8cbe9ca0f9205dd0193e274e6
MD5 6b69521d02016c97f8b4a1f90d9f797f
BLAKE2b-256 f16548d695f8884b13262725806b1f044e1e4d5ba796be0b0c0fa85e4b60a74c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 09f4c306c2f81241458c474a3c35c40d508a985f053a2d166bfb93b470b78adf
MD5 480e3d57756e7834ec0ce16bb8a20874
BLAKE2b-256 70796e2a697a775e1b31b926822a56592f822a0600f30335cab2e75ed9bfd25a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 51b18a824f5933480ff15d763a197bee30d296817bece409fa265409eb65a324
MD5 2fd06d5459d019de0d834f6ed719d5f0
BLAKE2b-256 95c0077184bf43091dd83e1c3f6b0fd9ae3adfd590801f7a7aa1c7c1fe1efa3a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da2360cc884eaefcecd3aec648f1785a5ac3c3a907185c3a98e8212291470311
MD5 8ec7743a84680f808e58fe4e134a9840
BLAKE2b-256 8e12b29dfa5267eb5fd5ce1642543bf2952ce79b3f208b1142a02256a001150f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7ec757c77e2197e9912a1e7f855ddbc590c5ac6936a445770fb5477cc4fdb6ec
MD5 5d5da9242921eff8f740e67595f70ded
BLAKE2b-256 39d036d9781d5070da108b06b1600f254dfb3f3bfbffa7aa619e6442518184d2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 64cca91cf053b1bb4cbe8fb4e387edfea415be6f03e94a12b748e76625a7b75b
MD5 e9234689b9305e2fa5bfad19a61f7a3a
BLAKE2b-256 3620264adcfcf20c9a077c5c410b3a298e91e985d2616542cf8d9a6fefd70121

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e782f83f03b186fab5df71cbf47b3b881f3dc942be59515d3e4db4e878c44dc9
MD5 264512312513e7e0b36307b8fd63f1ad
BLAKE2b-256 9f85b6eff6acaf753b3be0e8766eb677ff05a246e14130301d22e03503e54334

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 836fbdc657f003ade08945b40c453469664f352893ba28c095543b9e3e6a7123
MD5 970b73065e58d90d72c85786f3fe0c4a
BLAKE2b-256 71fd1cdfe7385382a51e20c9f6b3346985ae3393d2b5d99a1e128467322aeca1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c463fbda202068b1c9d9cdddf620de4153fac918801843bd689d042f07f8d99d
MD5 5c71ea3b1148897d4f8e8a75ec0edcc8
BLAKE2b-256 2de1429e7e1c75dcff1375743a3812779785c31e5dee39176ea66522c5930964

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 09b9147a45c0a1ed081f47e259c9533c848289371fb7220244fb240bafe46b96
MD5 6830d62c4c9f583d99cbd2902d83cd21
BLAKE2b-256 0b59e1f5cf86def44f4331d94de26f60649e404ea36433e1fb9a2c0848830305

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9df742524912258261720639bf521cdbabda3f6cf70ee2a7a8c6c1809beceb4f
MD5 5e114f50a4af8bf7c9ee3f4c26729eed
BLAKE2b-256 98ea8e190ed492f8f5a81b536e938f59cb603744963fd4c2096aa7a23fc29328

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7013bfc4307520ad9a5f0b786c93786c3587390915e68be1c67a79029d598622
MD5 9592fcaf40c2f6b729c336ec3bba0aad
BLAKE2b-256 20bc5daa561d3e4e47cd79f636483c32b6ac706690f387e4606521af0892bf78

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 64a94eb5bbec4b9770f75d4580425eb1bba02dfd9943e245640209c6f993041d
MD5 4934dcffbb84f946b21f8837fe20994d
BLAKE2b-256 2c57ae041188b6af85c8b3bd5905ded89b7c96e378b5e63b0b44c91f144536dc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 db207fb9a9f9dafeb20e5f144fe529a6e19ed7b5b20d99e9442035b30842ee35
MD5 f1417255cdcfdc20bc78ed68cc313da4
BLAKE2b-256 8b58c98bb5a0ef108138735f8a5b6b42e8eee2a18432f9734f6498feb2a68c90

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e752d50d2b7b259eb8979a4b45b498402442714bfc60332628718c60b11b79cd
MD5 f61c4c977c2dac41de3d57afb8d26ec8
BLAKE2b-256 666b9d8970476f27a829c60ae04dea3c2e0b70374697b3285e79199c09053d04

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc4ada1e49eb6456036efa440239d51b90450abf9d1fe0fcab3cf9d097ac0e13
MD5 d2da0f3909c177708f2313ca0137a361
BLAKE2b-256 8125d4f17d3b1f2dc47edb1fbb89f86465e03df8f39f46797f9502d4dce114d6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409181723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 28a56377d06e7e9c45b231b3cb09be4ff36061c11144cc7406b4e5029c3e258e
MD5 6698551e1c79b3b868a991237d13cef9
BLAKE2b-256 d31a2292d034ee9f93722fbabd0ff1969f31ceb896e2c3460026ef0f12707a58

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