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

pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.12 macOS 10.9+ x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 macOS 10.9+ x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 13e714d15d4cd9b5e8227a23447d21c54c66979e97c325855358500be54bbba7
MD5 5ccca205cd7e52b03f6b36b7d17b98ce
BLAKE2b-256 84345c9c80e2f2cd54af290da44d8d8e14f1d373f5e8aa3aae7343ac650b53f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 02ce5b4ac5c074930837ebdaa19b336b364369e7fe8a8d00784098743a37f3ec
MD5 2bc0e5824de3319f7b82b4347c9a5bc6
BLAKE2b-256 92c9cff8bdec9dbbd1327e1e44418551136efaad0f1d8c29c291e58834179f63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4e53b50046550ab2337ebc4911dc8f9aae448b6130b9eeb571adac7b3d5bb9e1
MD5 08ef6d6bb99d7c5554315ebaaef422f7
BLAKE2b-256 ced2b3c8679e87ffbe7b62df90a6018d856773baba191b09b2f59c3f48b01d81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 126db81521bc0e8272cacab7b953e834e0546c231f867044c2f709f31dcb51db
MD5 aca29873ca9af1018195bd40595f67e7
BLAKE2b-256 7a243450443e655fd131fdc454510b6cb92dfb8ec8786afe312daa5c60bb5646

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4cddc370e39231ffd8a3c59fa820cd388015a71d482267c661327718b7b9c683
MD5 940831ed13a98b4ce6b2c0a9e252f4f0
BLAKE2b-256 2016d72792ddd090ee37c02fce6d99f67e69267c37923523dbec3ef9b87de9aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d3c7b9b69aeedc39bce2b45fc2faae4c96240b4b65ac1e823be89901b4f0ae0e
MD5 0c5fc3d4dd91b7cedc214daa9ab59a44
BLAKE2b-256 b65bdf31f65ddfbf0bd4faa2bdd5b1e0ea42ee5143adb290633627b4a40c3b32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ec0a07d1543fe74186e30f8e48c86527508563351bfd15a23c17bb528fec678
MD5 488eb67b266524973f6595871fdf49c5
BLAKE2b-256 c2e7257619397be9e2984e2ae92efc8e8e214170a72ecfc2bf3a38dbc797961d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b761b54a59f65db8b6612464d21eccbf24bd009336685462b6352620854a2067
MD5 86c5c8a00b82a85891a8612fc149ba93
BLAKE2b-256 f9296c9e22ed672c150ce0fc2a9d0e3f5963b2b1a2d1ef444236b1100fb99add

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 639cad616ffbff0e88ee6e5b37df36a177b939658e20cc56074a8b24cc9eaf65
MD5 eb7adf3f02dcddaf06b0d8c97f0072d0
BLAKE2b-256 54535c76a5ef8470c382c11ecfe3be694d8426e7c98b2ff66458b2f21bfbaa34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 42843510a139c78f0740d68540b7b8d6510365e628b1d44537f86baff1d59602
MD5 5e8f3423ce1198ced7c8e2295cf845e2
BLAKE2b-256 079739e2ce78efa6477377d0ea5c62a68e34e8634f8c049f8d7c6a1c30e6ab83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 25292e6211730740ce5b2c838912ec04990b1c8a52d2d58c9a2def8483a6816d
MD5 a4331161d573f94ccfb67ed1cacb9ee2
BLAKE2b-256 977d82acdf36a0b71554d7dbfa7c409bd4beed8a155778a951af6efaa5049886

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 39fad81489d3c3c55fdd2acf6c812972b03c2f06f3605c631413b084e4ef0653
MD5 490703489c2a72ae72934fe1aad7968a
BLAKE2b-256 ffc12a0dbea7a4a4a4c0e65aab0350cbe2a358d4620af6c16b1239fec269d716

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7c6ad5b931f8b563fb01209a37f511921e4ea554d6f347552c25fe32140b7121
MD5 2ac03229d0f583b14218ad722b9cedfa
BLAKE2b-256 882c2a43b1e0c77cbbc9196c29ff1c4489968cc2bce405e87fc2544d351197e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 21a237b186fc50be2442d6b5103484421925bffb1f3af0f0c3f54484ec3fd05e
MD5 623f97e63681dec7f23d0a3203b02214
BLAKE2b-256 efb488f907b80aeabe49c93d4168fa83cfc1145251f3f3efd2ffc185a270985b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1ebd9e73e82cc2af7221fd5229b7e70ce7ec84d01e23a8f18a5639706bb1037b
MD5 82e324fbb2c6dbe4595646680662e367
BLAKE2b-256 2720ed0df6055a6c92052b0a42d99e4d6a7e8fc3df9816505a3759ac03c29dcc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1341860e26fde5add6430324f57594277c475cd5ec256f67495e31981052bfc9
MD5 476df586347796840c024634d4a54fbf
BLAKE2b-256 787276d260961307b2582039defc09cb1296674ebfbafc52809d47b5c26606a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f4e3e78b52695e88fdb2a155ecfbf0b543c1151bf9682b74bfd028be02da7e08
MD5 305652ed073ced28fa3c6d5feb69a995
BLAKE2b-256 1bf92766ef26366ea63c14b7aebcda00dd497e566d3a37008d98538914434a32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3b488b34d682548e319fd64eaddef6e996776d3b48a5c9d0374eb24ed2eef146
MD5 68af3f0dec894bb66c6716dd6f85e661
BLAKE2b-256 4632bc3429579bcce2d654c7b7f17062d542897e7d85033f2d1d5b65ebd4a586

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f0b2f53bb857f7509b8207086811bc9d0284c31c874878cac92d66a69f76614
MD5 b8d14657b7ca358f31c401b576da5c4b
BLAKE2b-256 8d360302ce2422c497cb13570180b51e463b0acaf6eb3ea3147344d20444c63d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202409221723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2ff95f764a85b2b7cd55670212cf7b15a27367a8506c8ffb79c608c626ce8ed5
MD5 8ffc10eb429e176f04f58108e70acbff
BLAKE2b-256 cda5dc92de459d999dcee1c7402f631716166f899db9058917ef557b3602298d

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