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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411031729615378-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.17.0.dev202411031729615378-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411031729615378-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.17.0.dev202411031729615378-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7a9fa6644d186667948d28c7be676139cf1298e1e1ff66070ac6012555fc33fd
MD5 0d02dc404b5ca0990583972e8604eb8d
BLAKE2b-256 d63fe9ed20343ae2b56c60f314569cad4563eacc23ede0cac4ca9c22014dae05

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fe5d71665050fba9c8c6b6362ca8cc15a910f7bc46adf5b608ef4612c2e88504
MD5 a562d9c93085fba828b1b13a385fdd5b
BLAKE2b-256 b15f8576e5be48f3722e97dbc9e89ea9622350c3a3991bf33cf1e84dd0285289

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9123444be49a2d314911e401fc092e90a3752702d47b41b1ccddf815ee723678
MD5 6351c2582f61be00cbff4c2bfe28c4e4
BLAKE2b-256 3282210cbe1d3ae74f7f184efa31f4e72ff60ec81b8e2b74a345379dca245071

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 274b6e1b8a5a3f0a6b689e4c0391f5ab19c31b9f834f6e9c57b38dfc55d253a7
MD5 b00be10904ce70f3d17412c2a9b69fcd
BLAKE2b-256 074979730f6a85446f0f4f74cf2c8eeb5a7164bcff9d9d4366f8cb7b8af4e3c7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 df88da304f32643201a6e1c1859a21c84686b78119d3fb6318c38dbd888ccffb
MD5 0c9517688d53fb7cdda90a410046209b
BLAKE2b-256 2297f6b72dc5b24d0d543b333ac852a3e96493235afce75e86178e8fcb08fb15

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6aec1e77e0cd4ad3ae522c723535732dfc06f0eca5d79023d4b0ff4a3caac7ef
MD5 45eed1a66ed746be629293b10c4811af
BLAKE2b-256 70a666f39144e8698b385d7e37691a6c6fc30276b898d356d8398016dcca5be4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8b96aca5c0dc15de2c4e8fa75f59a4ccd9a9f91c53910f43e15414e2b0253752
MD5 327d9e863c329c6f5de51c3b79772a1e
BLAKE2b-256 9d1fc590cd7b31e050f48a1c343efbd56916d991642ac99a9cdf014e30b0bcc9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 58216b3f1058c9a00aa94041342ae9b8f3cae0dd0a98b4f3e43ee3cc0e4c1a43
MD5 bfb69b1d1f8515a38aceb7bc9ed02aac
BLAKE2b-256 417415ad9d6d4ab92a63f796731188b1316db58349afe83cac5e74acf2406aa4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 52393bbcffec9873d2ee966189ec7d530ddd6c1b81c04e8e73eb4a7392675b4c
MD5 937cedc14b1e3f723805b6fb1f86ed68
BLAKE2b-256 2ff15b65be50502323011714812e6456b6404a946172f2eda7ae05855c22f837

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5c92d5ef4e0a77ccbdbbc5e1590f109a10da9874d47015bb9b03c13863bce58e
MD5 391415a593f60c48e6fab4e8e86be808
BLAKE2b-256 930597af6a8d7efbb7bcc859e709b53533f4a30db40077891da28b9042f698b8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9ad5baf221c4cf1dad5c1f3824c6f2d2089407d6c073719c9afbd3a87cf71c73
MD5 e7173f2ea1ec4946e401a8fc1d751cac
BLAKE2b-256 a9a5ea15eb1ddb5e629058582e5db149faa17b48cd7cef6be74ca241786dae12

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8c1b9df88efb49ec2db92b173af2c09df51216c5150d212d21ac9db05a71491e
MD5 b9f35e16737a44d299ff5496d975401f
BLAKE2b-256 7af7344d909407fcc6b7b142d1094f5f7751358c1e2be4f8715abd1b8445e173

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 22c0612c63bb09feba35383f4f6119e678f0bcdc7ce2858f53533f1dfca58462
MD5 07abe5e032bd21b7a311cf5f9ed64269
BLAKE2b-256 6250e963b155434075aa0c62863d735ba6d631593ffdd57a727b84b3c472c7d6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82d91d9bafd0a012f765a991a9abeb6bcb56a639468484f64942997064a25a76
MD5 cebb5814dc8441231f54b60b8108282a
BLAKE2b-256 07dc9da16dec4a425a96b79f97175a89a4cf1bf14913867cdd7dfcdace62ae1b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 61f1b497e40d5a6aaa0838976c14b9f00789c66eb712e3ebed7e45b234c8b5c0
MD5 318b26e76cba85ad353b0a5a9eaf8800
BLAKE2b-256 3bcd9578a2b51e311827f3a26edd19bcb25e89c5a98d02ee101a6c0a63a6d0fd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d76b658899e7c4a0fa4273d14761d8555a2258524c3582b804c7ae161c430605
MD5 4fa94a99da4f568e7d2f4be13527fc7a
BLAKE2b-256 225a9b16cb115aca4b4c155a27ac4d9e7ff00ec8cf40ac94019c23e33933e161

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 49e90001be1dc58c22cf9dfbec329c9b41daa9aef5c56f5e8d532a28507502e4
MD5 865d0f3194e17cf17da45814dc200426
BLAKE2b-256 0b979019c27e854c5ca22de29fb8a670dc608fb2c6dbe536c76f79d3ce7224b2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b92c18db7b6f5b2841b21026b041524b594bbf6805791a6fead2b9dbc87aa83c
MD5 a71c703e9c0ec95f2987bdd958f71e89
BLAKE2b-256 1cc64ed9aa19b373d9ea749bfb0b31d8c094380a9a84db86549de25e4aabc8b3

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0447ab73ec646cb09855f493ecdacf5bdf94b9bc75c6a8ce4d53e8c384279a4d
MD5 331aaa94396c447d17b8c3a5865606ec
BLAKE2b-256 6b78a85caa0f5a726a73dea61b624b68b843a3591b1d5e888aaa79382a4892f6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.0.dev202411031729615378-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 290292c23ab7f15aa03c0e9e2634ae9cde1928a6f10f1f60f136426ea128bd05
MD5 149896335ba89febe336135cff6f4173
BLAKE2b-256 25ad0c19e1834da50a5c4b71b3d39b1f9baa0efaa636529fbc1b3c413bbec7e3

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