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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3f7a501c34c5c294932f53362f0256cc004c85a5c40c50218a6201f451332c8f
MD5 e74ee45c6ab88cc609327cbc7009b06d
BLAKE2b-256 bb7118716027f88cd7a52c8904c7b15e2dd73d121f8c04039f3fee7de9b1d03b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dc61cf8a17bafefa3022e9257f6ce54896354202a1c4eb6f862d72650ecd13a1
MD5 5dfa137a006181cc7ac97aa3b0a2d412
BLAKE2b-256 8b315c6350293cdc824bec90d5f84223bc8268e803ac1b9e0cd5cba873f31b43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d2fc4dd3f17cf0068f94d140ba6411af2c1c9bd0749e5c989682ae99bb505b26
MD5 20b3e7f9a16305ab932698e833ed23fe
BLAKE2b-256 61693a3a361f7533aff7670385e57ace5f0da9ff5e59f5c4020f795a281f9116

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cb02ca59a24cca21e1780aa640cf462580894b3466ee86a3b0cf6bb1ea464bf9
MD5 015e777aa77f246dc25745ae8735c4d5
BLAKE2b-256 83a0d152d5aa4e7d03b97626c394ddc98e859c08f9c2235a9a96769a8c604bdc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d465d1dae7065ba0cdb8d289b607789c75674ecf7aa81ede31b4e38b8e606e57
MD5 f0d2e7197a6f61390c1f435124c12047
BLAKE2b-256 cb6dc8c2348752ae23947de9b4bbbc194601d9e8f0d2ab9e07a504445079d180

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f31261870241e63cf331a68a95047a9d38e98bfadd53b0bcb9919b4f4f2c9fc2
MD5 361985e7652bc0c6889fcaac9738fcbf
BLAKE2b-256 9c11eaf2cb5426a88406444d9ebfcd1bf6f3802de60df605f9c5c2f4892f36fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6bce07949ebb16d599161696f6fc1aab4a603eba49d4ab403d58ac77c9dd2748
MD5 a457c2a85e12111f33a4805e29ecebf2
BLAKE2b-256 ada4d09ac98c92bce958946bf3fab56e7241d1ebeb6d9b8c141b53eae51cfa46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 069fb1edf578286eaa8c64ec99b21ced646766b182ce8a3423be96f04d63fa44
MD5 966e6172c5869a78d510d1161d64ac21
BLAKE2b-256 5356842764940a4bd0c19797dbbe15653b6cba9860d37b8646ed98c01e241e15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a4dfa44ee6b0d5f1aca394750f8bd1cd5f53dea79c289dbc34600ce0a4986d0
MD5 d19eb8b2e61c6d0c429e3cbcffc0c0ae
BLAKE2b-256 40e50a314841eb98acdbe5f6bd424f22d7c454412ac49f58c4443c1c1bd12ec0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1917ad8a14315cce237af728d5394cc2178d32bc47b480cb7766c1990c4040ee
MD5 9646aac106b0e15e7df65126537a8093
BLAKE2b-256 d265601063c2bde8b3ae8252e2cdc909b82bacf9e270ab39eefee5b0a6536a0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5ec9b196653b495262097459597014834c5936341ff8508d3ff49014bf4931f7
MD5 230858b7ee013a6b947824773e4c381c
BLAKE2b-256 368a5e943a066422ae3915c9aa27660f6d9832cc8672e09323d490ce72f518e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c56d303c4871173ab4a046c28098fd16bfa07dcc4025b481677a63f906a4400
MD5 d353ed949efdd4ab9fc2c21c018b4026
BLAKE2b-256 547d419deed2751a53155759e33981d63cb9de21d5e9fb275766e2f0f5bd9049

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8261b0e2665a4982fb0f2167ff8d19d674e106586cdd18713c14027f5f12fb7a
MD5 3e64b8afe80c5b4109d7f41173d1c0c1
BLAKE2b-256 f378968af92d6ee7eb485dd0d8c2587c9c3a1256e18ba189d0b72d94fcbabd17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43dd63168f48b9e7619fb9eaeeb03ca9471c9b9f29fff1f3ac8bf2dbc115634f
MD5 42d2b8abf09cf5347f132a25f95a3dfa
BLAKE2b-256 8ad8ef58f576ab24f19c71e7d8185d1d2beeab6bae23ff5630cdaeecbc54ee21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 add1922ee2b4d4a6cf480190ef56ba87f2dd63fcc811af6bfcc6381a558c0211
MD5 34a17b1df787e0aa0e906f2e00c96946
BLAKE2b-256 651e0771e23c29902e350bffd3cc70daa52a8537043ba9450d9f6e2a96384106

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3352dab770643175ff1c91f825bc4a1dbec845d940b9642393da494b6a2b1831
MD5 d750885ebe1c83b1898809b3d61cf9f9
BLAKE2b-256 ef19ff2ef759667a091422ad053f21c5a4808c103d4dc79cbac0b42f88629061

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dc377f8ba094e9d980a456e149233a1406cca7930d77e2b51dadefd5e45f301e
MD5 86e2f084ceb11881297fe5b79c3e09ad
BLAKE2b-256 b6df119a3aa48510941d8fafb3259f290f269accfb76203e3bb79642e038eecc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 67fe3374bc085e10e64101fd441ac565eaacf0179a3a01f857a9f84c6ea88c62
MD5 ec2092665911bb0b035441dc413e0af8
BLAKE2b-256 72dfd058aad2be30a94191a5019c6d32f0e54bc84a00070033ebe32205624869

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be1e425530450876322eeb10feb20df2c1dd11a48edcda3d76356ce636bc3504
MD5 de3bc966fa1115adaff02b6d9f7cb67b
BLAKE2b-256 a9b17ae0d7d8dd4ddca4032764426331871a5da30e4156c1fd0f6c74349647e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501101731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ea84ad165fd69df25624628a0e3f96ef109a9902cf22c45374e25c5d81fa18d3
MD5 147870d4ba963896b60845f08127ee06
BLAKE2b-256 e13c6c43767b37d8435dfb4505f3b3c87e7f510a98ac2374b3569232ccd7b6f0

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