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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406241719095855-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.14.0.9.dev202406241719095855-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 32a019d056a3507c08a8de7b7df305fd54ba2e9fdad0930d8645cc4ae7bf01f2
MD5 791767266d87588e0e33d920ca5ba5da
BLAKE2b-256 4113e4a1e48968f6945471b2b78f144c86b60ae53cb97ab3cbc9c33407012cd6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 80ee42aff193e52969544a81069af0512e8c3d0a987800429694b35cda4f9efd
MD5 c0f855461efa4845a7668e3836be82ae
BLAKE2b-256 135d971f1f776d1beb9d37db671312b20a8e94d1b23342a63006765e797c7e72

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fa95cbf5a491d67373639798d5352039cb90c3886c80636c392e3b77faa46337
MD5 38b2acc1aecffb1dd1b182757b8569e3
BLAKE2b-256 22015978a8eb75703e1e740eaabd8046216cd3022063021ed5ae9e3a9cbd294d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7de389194f575da838891d7289ce616b1a8e17017cf0d8033ddd15505a4ab83e
MD5 e8c8f27d4dfc59e316f158e94fd7904b
BLAKE2b-256 a53eb29b5145a7f7d647684e22eb516c92394b8592abfa993c5f3558698be25c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2f0219e5c52a6bd7523806d77f52dae8b229228e50a0d8b998e0e938ea0464a7
MD5 bdc63f93c9144169d471d22aabf11ddf
BLAKE2b-256 2ff7d85f0e9390294009ebb884c0ea0e30ab944d9280ae4a794f71f3d554204f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 473b636c190868712113491191fe2c62587ca5c563a99ce3be333d11ada7fbab
MD5 7fd3ce9a234d94bef0228d2da9c7ed44
BLAKE2b-256 0fd2c32bc4a0eeb60c79a58f73e4d94991c9f9412414a9a8d19d858b92fcce46

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 13daebefc637a9dcb6544f5b719c95c388d4d67a93ef8634323851301cc7e040
MD5 343d4591fa83c14f6804c40721fef6e0
BLAKE2b-256 8c1329e562c807ba5c86e4419baff7831b70478d9957bf002769db14f1cc4575

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 60b52bca275544606ffcd6733d31afd5e501fa1f25dd74861465ab1304dce540
MD5 467ba5e17991636370b98b14387cf53d
BLAKE2b-256 f38eaa0ff7b66abc46b35933d5d1f0f9269d6d125aea95a4b0fd77ea588e0e88

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05b158ec3f24ac335e4b54e62bdced572bc1db7dc24b3f33f39bee6fb7fdd66d
MD5 8593e10c93cb15ff7a405b23d1df79c8
BLAKE2b-256 6e51ac41d092dabf2609d36f25f33cdbab3c34e6b4314b7ea7288049e8ffd336

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2b3e41312cd1641caf62a69e58023c5b18651154cb6a9a4eb87271ab9954449b
MD5 6314f870e36af807bc9f4c32078a5973
BLAKE2b-256 ba44706506077f95fe4a9ae737a960b356881c09b1b89b464229acbc9b54cd72

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 85eb2d7d5a0338ee8d515e0e7c37d758e01527128414b6e88398134431d98469
MD5 d90ae07cba912d99657075268631b925
BLAKE2b-256 7114289bb4d59df6f414da2a848ca7053ba1c51ef918b3c86c6b37046b78b187

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2229210e90dec43446369de9771518410bcaa7941dcb0b1f8833a100633a5bba
MD5 238320eeb49b811aaf09d7f022f7c7d1
BLAKE2b-256 6943964308f6391faf4e657fd2b50011611d8cf5b5417707a67e6c263b3e5d23

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dbca2c7732c500650a762e6bb0f6edb2eef3b523894958061e871d7d0548474c
MD5 5f23758969058e6f94f150950d50b1df
BLAKE2b-256 645817cb77172c8dc805a05571e5bf7d425b35065b053a3c9d37973598bd97a8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1b2194f4d0394936e8651f3734e34f473e077608fa6677d18493cc1f2d22ae06
MD5 d383bfefb5065b1fffb23989fe16447b
BLAKE2b-256 ab54ca93a472ae5ed4da64e9712f967369c46047adec49112ad93c09def18e2a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 589e438e6044adf723cb42b383ddbaf922240bae86249e9c283a00f1b1051797
MD5 f34a8e1669aa24d4ab4fb012d0762cc3
BLAKE2b-256 295d2479526081e033b2b7e8a7d65f77693c46d508418131886b0699b9a73556

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 71f864300546f5b19ee680d2584d27bbc1921450d0e16ac9d11a97065f6dd893
MD5 85236bc743db5b91b4f2f1cb3075bbfd
BLAKE2b-256 177a1bd7a9f89a2000fc2a5bfba81653be925bed7ddc1028fb10bfe19c2d25f0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 222dd1b836b2d9c794a6c7105464aed3b6a44d64503d5d7e3fdde5d2fc10cafc
MD5 aff6b1f039dd5c6df9da91d28277f96e
BLAKE2b-256 4dde9fc3e68b9e500e0417c201753120bf12e332a2b10a7f17fec2514c2cc326

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8ca1dd0da5388c6926e48d2c99477e94ec713d585a4c2797983c9262b953e457
MD5 9a4e4c4b460ae453921b8a7b84eb7a63
BLAKE2b-256 a27044b237a64812a79569d7ca1e9fcf90b3d82339b7bfd059c3cb4475de6efd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed04f42c70abd7343ed86ae763d76cd4de0c020b3d8f46dfe25c1d40032cf1e2
MD5 73d87565bb55c52738000bd2aaa234c9
BLAKE2b-256 c9d0868bed2c3de6f74c223ba6e89644cc043cb7bb62ef30a03ad8d2a6454af3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406241719095855-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 df9227cd34b8cfef095e3d1f7d6538293f6593f1b1e53ea528aa91c376083c5d
MD5 c95dfcade9ef7c3e39dc04869a26a739
BLAKE2b-256 f6c36503793735e9d380f3db87be997ebb507b56264b27de2dba739cbbdcfcea

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