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,2023 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.13.0.9.dev202404091712167003-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 418a0edd5d974b4020e59c947a56d7697848f2e6f4570f87d6925fbca9fc3077
MD5 2bd71c9decfe008e5b6655d04a34c433
BLAKE2b-256 0283f465d6e0f0b073b4ce9df75a41eb17fb7b0f124047f8752ee856e3da606b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4287121875f3f39e94832df01a89e2c84753c75448ce1e0fd86ffeac1a81aac
MD5 348bb220af636aedae7d04dc6b05f052
BLAKE2b-256 59513b549f8739cd6a005d5f8597c609ce091eb1322f2640b6841f9f222056b4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7217434df7f7764ad38181b6f96b75b33c32e6af4a7b4e6314e15cc4c62c958e
MD5 bdf3a615b4f1607d500dd52d70ce94cd
BLAKE2b-256 9b54889bb193ba9216247bd18d35f9dc6834990ff55e9b39bbed426db8f1bf46

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7afb1175479ae93e3c7aa0bdc39ac330d4cf5534ae7dce69b07a1622f7f4a534
MD5 e1bfb7cc1786d8864fbc05c02b659903
BLAKE2b-256 fb61d1e46e0b91bd91b15f28791be91c7d7c4fa08d0bde4c23e8929327d017c9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c5aa04ff4c23674951394e8122d48cecf2b4df8dbe9b92f38e9a201f21878d07
MD5 a38540c7fcc77fc3e9eb7ad111c64ba4
BLAKE2b-256 a93169dd6538c9f084e3cfb616efae0785ab2f803f4d3250ba73d686b296729b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8b2c24614b4fd2540d2dd7fb4491e669b2d80ecdb76455430c25995c6d35a1ff
MD5 d5e4b706f780008b68cc4e2c970cfd5e
BLAKE2b-256 90976f12ae01aefc31728d5eea39832bfc23ccaac7f145b987aa9cf46f2d8294

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1255f595f786dd65f66232aa9ab130079668606c41a8f152b948cf58f2775a08
MD5 d7f68dd320383ec2832f9fa25b903793
BLAKE2b-256 247292465d4d817a34d032e431144da023687e0c3e264ff7c5fc19540e5565fe

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1f64ed1a5004e6e4c7be02e0a9bb88407289a0e74c4dfab211bb3cd5e170ff13
MD5 d3291700d3fef0a106009395251c674e
BLAKE2b-256 584b611738dce49e8090d6120970f91776d8a0784e125e6acb704f2f4fd731fd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9afb50ba797b3214a02d3679285eee6a05b1e9e4eaa2509848612e2ee339035c
MD5 0326a776c7c2f31e8fbd3c3f42e10cb3
BLAKE2b-256 bfd67f8f7219b2f5f05111e2b1fc4efa68962da27adb4ea9e9a9f08d62c3c94a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 832bd1f6f7ace76e4858ed97ebb290df6bb265a6b44126743af293470b889de2
MD5 e76a634aae9685ba9cac4e7377349ff1
BLAKE2b-256 07965bdabba9ce0080db5b8559345b51d380d66952b056af9a241c0d8d3e886f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b32a363cfd50228f9cbad576c4179396500b37964ced6ae62b2fdf23190e3857
MD5 81a9237ba6ca308e357bac476f467002
BLAKE2b-256 fecdd070d3454c761283566e4e2da7c562bdfbc751d157d604e255a7712d1838

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a76a08ce83ce93412d194cfadb850877912fee925e23280fe92eb16bf8a55bd
MD5 ede9d4f7a93d1c44c8d4eacb6605d1b3
BLAKE2b-256 cb21d6fcd751be6d70379d772f8e1df53666c9703e14d6c128e629c0bfa58814

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 78fd96b6538b58bf83364a3cac3830ae1befb0116638bf2cd5868949d6594431
MD5 a8eba98d365c3d5c651d65130879bc04
BLAKE2b-256 8c96b081b7d86661a0412bd78ffbb9343bdd5e0358984181a99550c8b56ff51c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3e98c1a336f8185215069d331f3c3f795652c228c93c0122e0f6f49482e32ae
MD5 3f11a0f915d0b8f61e00d75a10709f55
BLAKE2b-256 e05b8064b9af17ff9850e7972e55c601bfb340a1d46dc503815c13abceb5c615

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 46031f45c40f7e37f7c7790bcbcbb7bfc0deb494a10c93e8b98308c1a5aaeddb
MD5 797555c6c381e2427e1ec4a14347d2ba
BLAKE2b-256 dee66f2f7c04c1d7500d6ac0cbe9c587aa23cf6a3a83baf95c7ec17a5462a04d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ce49670bdf9c64a6e2b2a8823bfe93c7c8d776c6acde792b08639530fe02f636
MD5 d02a0134e25ec394b0faf32ef91e927e
BLAKE2b-256 92eceeff0d72639b8e7fb7a522238e68d1cd6c9e06fd070cb78eda6fc802df7a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 514982fe1c319950028c786fde4b30491cfd51577333d1be97873f827a106ecb
MD5 c4d24c5bbf9ea51637f0f3eb87fca07e
BLAKE2b-256 9f64a2f04872eae09b86ca5a000f5125d7e24a2eb87e119c4ac7c1c2c0e28fdd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 406232a0816350af258032cf23fcb2e5033869bb1a09e2111e4108aa6948c797
MD5 5c77ce6ce1d75b2eb24084c6ae40309a
BLAKE2b-256 46934d262f6f35b6b3dd678b00bcaf4a21e2951594dfd66572bedcf26834c67a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f8de62c090ac3882cd833147d271e5153b313b907c7984bd83f21e3b53a9a7d
MD5 4f99b09429c09397cb3d8d950a26e800
BLAKE2b-256 003134e8741bc10a940c01d66116f94383a388f2f42ab1adc8c90f0721bbced3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e46f53ee4bf63a39cb97432759c00813006b8a58ad9b6cdacc7158106378681e
MD5 051980a4fe6b1a2726d8bafdf521f730
BLAKE2b-256 16c8909e927f5f13fb98d881b1841725993c9af504dc800b5518cfabc31d3466

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b8c075f334d5823083a1fd989e56528f34e46c34fef4d017631a0c4c1f9d4831
MD5 b606b0ed9e9159ef95002bdf21252775
BLAKE2b-256 a6a1630660ecac19f96aeb234bf7633e663a06a9a60622222e82f0f904e1b308

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 805e063aeea87c877c91a0beb53925f8781e5d1065ce45d2a8b51676dd34ff04
MD5 fb2072292b4d0d70c8cacca65bd6a96f
BLAKE2b-256 4b8cbf9dcfe9c2f39cb39baf078b3f7fb6e92492015039ff06d598c46a3fd8a6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 08462b9ff89564dc9f11c227e365e81846bff3ca677fc4c64733a524f3223cbe
MD5 34047b7af186012cb006af85b36d937b
BLAKE2b-256 73e4945b234d8b25d3f1f732e973b42ceb08f1a7ede0738a46824bf86a0548a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc4c67a7ecbbef80075c3bc76759273415679bcab57058d7438934dd8915a2a3
MD5 3a2c1d1c69051db7f8b19c81cd1c819b
BLAKE2b-256 eb24b950377952ad817e75bdb3d60d29d580972439f971b1b6fdb4975f3efefc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.0.9.dev202404091712167003-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4b0cc5df0f367da165714cd0dca75942903e3a6ee6af69dd64960fd0bb836a22
MD5 059b0d808e7a7da60c010bdf6658bdbb
BLAKE2b-256 1d036a0fa59729447030bef1e8f6efb922464655a1ca09359f485a59f5a13d5f

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