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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6d589dbceaf5882bc26fba6615186c5c2bf5ea8167d1a421b9b91747c981d7b7
MD5 099835647a7c41f505e46a84cd3cc889
BLAKE2b-256 e281cf59ccb7e6393aace10492f2ce83f8586caf6a5e6c01324667769fefa70b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d01fae9d1c091217e0f1efd3417c20b9d2f29ce85b6503cc160e04dd78ffb771
MD5 388213126080ca9fc772120ddb1a9e7e
BLAKE2b-256 efbad5b8dc172af443c6675fd2e6560e366b8c89b56b79399a5b283aa0935de5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0f039e8b05317a56c45ca820702a79ab6193de878dc8fb807dc34c4a6d606df6
MD5 f07b61bcaf1b553a61ec5fe76cb07279
BLAKE2b-256 6baba35e1d2dda71978e5f0a5927faa4b11a17e85023ac76b283db8bcc2fdb28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee22cae9b4a3c9cceee5b02d1811d8d5e8e8686b6a13d1f0f4de65ec3f09ae0f
MD5 9d8ed7c8244c4ca871fa37082f93f7d1
BLAKE2b-256 6e41ad79b60c7bf137b81130f7765529f9b22f089bbaa0dcb444741033b96329

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6d87f283a943412234d948804f3994ed2dabb7c65875d2962676d409d22af96d
MD5 a7f2c79b21786390bd3bb52699cd30bc
BLAKE2b-256 e936664a986b63453c57fab6c7d056c5b234defc4db7e88319d76bf4e22578ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6340b9b5a8baf0404f6eba0d6a7477a5243c12237e6f86fdc36d112c692a871b
MD5 bbc646880234a92aaaa02f9d957c0dfb
BLAKE2b-256 fa52440e7307439787c3be916b14b4a6724533dc9d09a6efae4197a59c882681

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 058b68d733a1d9a16517f36b5d527afae8b4d523fd4c0f8c0b983a3964ed2be5
MD5 3789bc4e3291a6efacc8b7fc2e3cc337
BLAKE2b-256 94faf14b820acea0e19cc64d685324536397d69d53c6133abf0fe1f561d1897c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cb062edc35294ef045c3407c0ba68956e4e9f980ef6d035f1f7be1c945a01a42
MD5 10ee523c92ea0b9f5a88983db3a6cf88
BLAKE2b-256 f5d2159e5a79be66cee63e285a81bd339aa245f08d5d993139414507bd382c1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7dd3c6fed7e8b033bc10faa1626da63d9b5abf7f3f2ba6b0386cec3e0e9d33c9
MD5 a417461e1488dea4d58dd9069efee850
BLAKE2b-256 78f0dc342b9f6d82cd7f553e9646448ca691143a4230ca022bfc94312e6c07de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fca7e975917806cf1ef0f5b54db7d9df5d8b5f57d8e0194092ab53c78cfcf140
MD5 828b8c5f82f03746732499d147bcecaf
BLAKE2b-256 9fe688baea81c547e2c498b5d0daf67c9fbe994fad8d39b1576ebc5966331aae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0ddc0b4e6a08d6a76ba6430ea944816c81bb0310cd00ccd7f8d175bb17c496df
MD5 437d4df2f08610a926225ff56d45a2de
BLAKE2b-256 12b6791f920da6b2e71099f4260a309c5f46c50710744ac824e307e56122a5f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ac2ded49fe3b3f415d78b59ad4afcd6a0f088aa6c00a7171c906b8ec24d5f519
MD5 cda998a85b876e482e7aded7ea7abebe
BLAKE2b-256 00c0b1e0e2d4c55b2baf5d30cdc053957cbf59692493e5317b9c7281b0554ee2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 69b3c06fb64803bd5eae1f318a2750e3f9c32990b93f56b315148eea67230f08
MD5 fcaf6bafbcfd603da555caa1cbe4939b
BLAKE2b-256 e245049c3e3d195947e264e393e8ae9148073c2f9ac1ef7eb9d8f19bbc08335f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4feaf270aa6d219e343accd49be6a538d2a5618a744fb9e6d4f7bfb23dc3ba81
MD5 ed717ccd1712e79482beb6c959700aee
BLAKE2b-256 7dd7b190fdb46132207f4ab14a00afe19e2e0650b48df807be37d60d24b9a207

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1559ddd897820751c9d8f446b52eb483ddfe7dd83940a62144002bbcfb24ba40
MD5 bd88fcb5c3af98bf3e755b16443b8f17
BLAKE2b-256 57dcbe90b1de5251d31b1ffa6a09917fc2f5d83b1bf497fae79d366c888c6e02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e1ef94de6bf410882f289da7b851adbcc08f606f4be06ba85afc97e7c0398fbb
MD5 7ac55dcc1b925051b0193f114f2326cf
BLAKE2b-256 42248771465cbd054ad30a6ec8c8f082ea4c616160b4f541116685cb604d8b08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ba8064b574ed3bc550f24828a26d2e888efcaee713dff5857c10c78c3cdaf483
MD5 f74928be5efc81d7bfb9bdd0c67d0439
BLAKE2b-256 82bc795142f78d793c3bbe4a774d9ddc3427d76b480a29865820bb31fc7f9193

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d2106b87e9082f8d9fbcadeaa73860dc116b2eed80d0f2adf7d68b46725bcbbe
MD5 339c9afb0ea1f46fc041c83507817402
BLAKE2b-256 db03a97cea311d0a6dd4fc50791abbc643d170698cd9bbb8a9f9f57bbbdb76e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c41c13e373b4c147882a0272fed8260ad1bd062e5997c8c9c12c53b769e3be4a
MD5 aad6a3c9a27f97e9f2a8586dcbaab3d1
BLAKE2b-256 368b3d15b5e137f10948241bd02e4204c1db77681beef317ebf994f8dc5c07df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202411301731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 407344ff4c858a9512f8228a4b3b71ca20ccba05c47806eef37065a5da6325bc
MD5 37ebcacaf5b4e4bab7cdd29d60523d5a
BLAKE2b-256 4426a3f7e07461d448f8947a389fc05fb42050e6089c11a247a31c89f406a9f9

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