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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408181723794729-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.dev202408181723794729-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.dev202408181723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408181723794729-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.dev202408181723794729-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.dev202408181723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408181723794729-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.dev202408181723794729-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.dev202408181723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408181723794729-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.dev202408181723794729-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.dev202408181723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e965b84fbed64b902d13e95d6ed238e3a8269b57b3e811f548895f4d97ce078a
MD5 b0ca2f5b4dec5ac8f850aa99518b1483
BLAKE2b-256 59250849f3077ec19eab8454d1087b9889e03a6fd5151197d7610c518bdd2dca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2181b4be8dbb6fe28f61b4eae819ae50198130b2272f6c6721ad44550b50c554
MD5 a1d4f9b9d7475074a46a20d8fe9f7e82
BLAKE2b-256 6936baa8b20abd9bed1048d83dd55f510b7186fb475caf360abcdbfd44751755

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b7c125c3b0db0fa96958907afd216da6e4605dcdbe7f2bf4874935f66c90099f
MD5 345fa314c90949312262a6f8f8462d82
BLAKE2b-256 fe51a23cc61f43fc4c0bc416e769fd52b41fa265c9c1f9c32d3acda071d3112d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 92177ac2f15c35fc9c79ed494f7f628b781aa0c3282bcf549a6009ca293c0ebb
MD5 5f96ac106058b5b2997024693dbc1a24
BLAKE2b-256 b9dc08e1f424d423e349ab4aceea88314e1df6e1c20a78f4de745bd37aa33a13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9b8348bc87992febcac8f5e43a3c9ad95d1e35aef73708fd241664f80a61ed79
MD5 24a5d891d509eb0cb999c601a2f27acb
BLAKE2b-256 a883c4b1642b120b2857b6e60921b83bbf6f49c091fa307ed7ffa60f99e0e8fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c7601f4037d05caef2e5d387fd31b61203e9f821be92eb95c01f4542622ce04b
MD5 982c418d3cfedcfbc2e61ff046665f97
BLAKE2b-256 249784c9a6047506675d8c0752552a2b81ca375488c28845930a236e5aa42b77

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 19a71626afffeb6b81fc08f496824816e4ad683e1639708fee931daebe7230ab
MD5 8c2204875eb5ae570b2ca14d86d3ddfc
BLAKE2b-256 26fa5979d8f4d3fc3b7be90a9fc9dee9b3faba99b5d6d3462802781bef7c1af8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 95e5f4115dee70a18be29057d641613e67848d4ab2e787a517cfe57ca0812d9e
MD5 f81e1f0f28662388184b2122db0fa615
BLAKE2b-256 ffa50c3c43c292729d9151f8dea5eb7b66df3a645ac928f59f4c0f7581179f5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 72ba5781b44428e18923ad5bc009df77afa45f7ee77183db70df8b6bb6f4ff27
MD5 55517585889c74fec2e3260c829c48fc
BLAKE2b-256 c4925aa9fc4f351da4e7792e77ebc1792d31f583abef875137eaf20c310b4eb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 661af1cc99a09133c97a9ce6e8f40fd4b82cd17131968b074ba775042b5a2984
MD5 c404e89b225c6cea3fc03a5f7e749e96
BLAKE2b-256 7357364281fe52d91619258e9e9bbafd06b80eb7ecaf3d576fb50bbbd1c7987c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 62a74b1f3f9a9a98872516a565490fe9b283febe979d39b30bb2852dfd3780d3
MD5 29b93325d5f021b0110cae2c5faf9a74
BLAKE2b-256 7732275ed3729c3aed258eb38983163a6ee3bd8a34d1b9faf2615439dfe5a1cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b451f09c218cfa26225ea1c7d8a4db317a5ea69b1449a38eeb9947bf7f4a3c3b
MD5 8e93de5d442a4a91180fb1549370ea38
BLAKE2b-256 eae78425263d3646c02841ecbfee56cb000770bd1ac5f6f9ab9f5e6421c26484

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 df2fe388396b017657eb8b139a75837166d11ca758aa0bbb5127e2bfdd59d5df
MD5 97407010f471fd188caba53686b7eac1
BLAKE2b-256 0330ead982e37f4afaf7c6bbe41ec3b6f051e8ba222412c4aee61d1364502e51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bbb4c5ba96888e705e45a4fdf00d773a0f5008fd1134e1908a6f9356bd0ee23c
MD5 c8d68fedf79229fe01bd33c0fc282578
BLAKE2b-256 dadbdad5247286e0a748c16d5f04de9ae4aad904f86bc2fd6f8c8ea0faed8f07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9b9f37e168151c9430f66dd144062557867021e2e679cce857f18cd759a0cfdc
MD5 6cc20c67d63591adad1bbca5ae4c92e4
BLAKE2b-256 5b026a5c61fda05c29be1d9773fa57d18d6b62aa34deeced9b27d2a9a3702c23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ea3c6d526f924ca66f7f3b5e898f4ed3f535275908c7c31bc8892ceacdff87ec
MD5 9fd90d54dfaabfd01ba99824ee5690ab
BLAKE2b-256 2f750c8215ba9ca6e8fb46a287ca4337a4dc1232348b0da169884698d3055b67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e723e22821c4ebde3ededb975031d5547d7a433171f56aae55729f574c411b9
MD5 cbdcbe44575611001cb21d572ed9a453
BLAKE2b-256 9762f405284277cb8d94e5ad03411e99b2797c934aa2f8dfc95b5232480ec800

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f3d964ea5f7dd974e6cfa6a290a974b6cd2042c6b97e3f5f0c6631d52fc88434
MD5 4c60a0f949e55c4c3dbb96777e83b02a
BLAKE2b-256 a0565a73976ca5b5abda1818187d4fe6be2e717ed048cf53884338cbdb4ac909

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 13482f4d463f964b8155b9c625f9baf111f5bcf80b604205da4c69bc8ef44a02
MD5 1dbfe178fa6303a517c8c6edf3ba8799
BLAKE2b-256 0bfdf4755b6729bee730fe02bede9d90d64dfe0dac15afdafaaee6c2f8031c57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408181723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6baa9b31b0a97b031f2576a0f7a63ba255630d759cc41d4d6a99d5554f4dae81
MD5 fd229c02d5a9193e39083e3b73b76c22
BLAKE2b-256 26ffb76708ccdf87cf5ffc8349e39c33d1f7b16c9594b7426cf3ff5a4b500aa9

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