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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 eca8b8968647ac3939d7474c6fa7c8422258d7d94941b646bb47a63948875522
MD5 61d4c4c0d1d9c6fa3acb448e0e5b6dbc
BLAKE2b-256 32b8e5b585e39a16f2621b897fec7329ae53d4891f3f652924217a55e1d319c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d0c17609f069ef7eb040f78d9b792b488c4ba1d5a3f7273f466c0efbb9a441e7
MD5 ab90a56b7107f276a749856e014ccacc
BLAKE2b-256 fffe1444fe1119ccf498299b11ebd58df606db453219c69f1f8b9d2f901a9994

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2aa0ebf3c3f948c119eccf72196634c9cb69df9a7420d20ad4cf9615e5e69949
MD5 4b562ab31e7134055cd30dcd60fdae20
BLAKE2b-256 db83dfd90fe1348bdfae864ec8df17d9ba677a3c902169abe7fee1db870414db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cbe653029de05eb6a119bc23d9432765b22096b60397c7f8b22a2748de075500
MD5 758c451e010b241e944adafcacc1e282
BLAKE2b-256 d210532a9bdc5bb599a4e220cbb144da67d80f94eaa31ad9562e4dfa70d1e7dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4feb36afab453def2364cb47b2d2d54142e6f5bc5fe8c5e4528c58145c5b8d4b
MD5 5683dc90e9132fe3eab7acc450dde746
BLAKE2b-256 8354b5f29742f4318c0b071da5c0099832022b7952a217da683f61848b52adbe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bea15989197ec4ad448d6b8c75c3d7ad35cbdd99738bd34554d8f226e76a1e48
MD5 8e0bdf4d8c94e103652123b5bfb60c4d
BLAKE2b-256 776c7e4663783aabd3fac76d7be7414233a125d9cb98223f1e891168836cdd95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c184d6cac3f095a9a70e42d56a659bcfab68999564a02e060567746f3dca552c
MD5 9755f70a1ad816ea07d1793d95ea3554
BLAKE2b-256 45e7025fb33e823e9db49c8d5a71481633af16ec2296b9e305dce1cc82a27273

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fda2e0321f476607544fc2576b92077ecf80eed7e2e390399ba863a53fce5a70
MD5 5a0821b2a0225cdff976f481f959bdd4
BLAKE2b-256 a3e1ad871ffbbfb158c5fdac7d1963d82af322878069519431366c6737816b2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efc43a2f9df0331da54e35da8c1df80930be7be2ce25a41417952974d2570363
MD5 9e7c2e952e0765f5bfe3c14ba0916902
BLAKE2b-256 9f96a4fbdcdaaf6e8c36392459974b24aea2a801f31f39bc427fcadee9aa0642

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a2bf7100a6e262c9f64800753a5799bf798d09d4a1b92750d32ca1ce757cdc27
MD5 dbd016c30e1ed5cbd1575b5374c37300
BLAKE2b-256 875bfb979a1b6d66031457da37d23252ed273e6f00d7b1026ab661d0914f9406

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3d1bd791ca429cc3e8655d9a29f15aeb26c9dd27c6ea1c5ed9c4a13d7ba78787
MD5 690a98e6f3a3ce153b4961bb0dc298b8
BLAKE2b-256 72630f5ab7bf846f9fe6f9e752438b4744da6dfe0e7188e5dc7b412b801e41ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94f39bb2dd9899f5e679cf1f832a13fcd3ea30865177ad224eb98763237410fc
MD5 c0f64a72e8877fbd7c7ec354d9f6f73a
BLAKE2b-256 4f7683538290b3f8f136e8a42ed711bdd08028eba70a40cd4af1eeeccfd8bd49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bf6dcc0f889bed2f2e58022830b2fd7cfd067a7fd4d0fa952a2b1c9ea111242d
MD5 9c350d450852f39eeee84659e147a966
BLAKE2b-256 ee19a8f6a7ed23c31b3736f1a6f09fceacefd18ec6b16e5fc1a717aec9602682

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 964e15adf27e2808be4bb6d22bc3a7051db3ecf9b104fc13de137ae208675602
MD5 31479478fcd8f9944dd478ba8a7d1713
BLAKE2b-256 81868db4f1ce94eaaba23e863db9c94afd39b1f4f30e87184cad24ef8e9bf6b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2443d77ba5e42014738861662a3d8cf798da5935211ed0f4996c9df2b17783b8
MD5 93db41302028c5219e942cf2f251b824
BLAKE2b-256 81f6281fb14dea639a4dd50c5a4db0848290b3910af2fb14fdef134c22fd318b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9f2e1715067cb5aaf4d3cd07e1bcc851b9654e7452b7440b20a0e7e122947f28
MD5 391488e7617ddf2394f941d01d8e9acd
BLAKE2b-256 bc69e19d9f07f2d1e5d31fb6b717cdeb53cccccf76c199fd14a7f78f55a21277

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e720d770e2463a6de9efd8d48d50cb08e11b585771ceb81e5a5dab5a85b8e1fb
MD5 bcf3f9009491d1d63ad90931dc5486e7
BLAKE2b-256 c77e60dd00b2a73117653be58bb717cc1b3e70763dbf0cc60e85f7d4d01cc679

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 54e0edadc733cbb8607d70067210df422e90975a614cb3e0538cbcb831881657
MD5 2244c3755346549655029fc92f2a33b6
BLAKE2b-256 af3d6ba4340c903ccb025b983a51c1e7a276d66898d2c55210a958e750c8a472

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e658ea5abc518c4cb92e47769167506a31de33dd1b201d2906d571ece382d318
MD5 a2b56d8e093fe45f4a942d4c7c92c417
BLAKE2b-256 44338c2a952a454efe1b31ecf3a7f1ed92ff1677b56d78bf7b51fa50526b8bef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412191731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 915da1ac5aa1c6b8c365a9bcdd3e1062b59c494684495d9ae2cace4facbf2ad5
MD5 37cb3e7b46fdce30f2956a8c23077c18
BLAKE2b-256 c98b8fe13a31d78194762904f2128b68e72dcba6515c87a5166a39931fa26064

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