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,2023 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.13.1.dev202405011713370971-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0200741377f9edf46a2e25ca84c0bba2079fe7c55cbc8b3369544ece5789f480
MD5 5e34edb3f652fc6c07e993c9ffb1ac67
BLAKE2b-256 09f6709c91e3ef0da8b70e7d0b4e35c1ac086959fdc5435cbe66f0f769dafea4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 877af9916c1b8fd58c50a4e488b4330cc1aae10cdfe726c2b9e899ffdbcc716d
MD5 1c3c1d4e4f0efc2c8343f962a0d9fd5a
BLAKE2b-256 0585d570798522c10ea1806e5a06f31682847229a4ea31c5e8807ac7b197c571

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ed1f3a41d7b6f3a9a2871fbfc57546438c6e8109498293a45ef8a0dfea305c93
MD5 df1bfa287f0363ddcc9379f6d6f15f8d
BLAKE2b-256 ce00b65c2889e9124255bed5f374744b2fd34d03871aa9e3e2ba92a1fc660f64

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ea6516b9b76d462e6976494cecd26c171a6d85abfaf1dd0eb390eae8557b31e4
MD5 365c0c90a9671a030775a8e98f11a73e
BLAKE2b-256 521f0e476ae3d5a106d09a298d7a23af330348584aabd9b2c7d7ef9d0242e788

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2adeb55c58043f88ff93008f38309000f5afc1d91da34087d7ddf8b0a29e3e52
MD5 f2a328f092ff431c2db3b3a7111f6d6f
BLAKE2b-256 3e019cd5e9801fb82bebfdcd5d251756dc4d293d9d9760f5209e8add16de815a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d87556c858a84654944404f56b5f85ef0e0aaa173f7987a288c28e3a63c20278
MD5 217d5ced9b4cd37d8a2cf0a9cf04220a
BLAKE2b-256 f65b683c1eecf03f93d5dcdda172ea364d2ee3176ffb39cf729ae9bbb08572bd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f87cfc3d662493183124fd7b14b9642f3a041e3e23e8e146ab7f7559c89c5a47
MD5 eda99735a4a5355f7254017d1e598c0e
BLAKE2b-256 40fc82d6524c20effac3e3ef52b0432ba4a36ccc17182c951b4779a28d25392e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 11c090e08fca0754e216b04d57ac2ee4380fd15141c4a520ded4ab2514e177c0
MD5 a2a5123bcff24b25b3ef635c92b350f3
BLAKE2b-256 b4f734016cd09848b2c73360fb4b1d96deb461bb0d97790e633269961995418e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c0791aebf270bf66cb48e2c3ddfb6f437156aefec1228f03808f79f45faf974
MD5 0561efd8d42a499a82f6b99368e1bc65
BLAKE2b-256 90811076012638978fe94394272912113f713224773541223e614546d89cadd1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3ead79903bf69838365462682ac28e6f37dbab4a8cc95f85b6111c9cb4caebf3
MD5 bc3df8f35f6f7731c5e910cffae61364
BLAKE2b-256 704e7b18aa5c02e9b58afa02ac2b9c0b932d5ebf1c5d9d5d0672440774500195

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e72e24f324e04638b031374b523c482b925d83b735bc20d4f48dee1062bdf33c
MD5 1e1c58c5bb34b1eee929d0f4336aa826
BLAKE2b-256 c06cef3e2213987f4bb3b2da3d047ab38e8e1321f65b3d635b77e1fc915557a5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3181ca90bd7b0003c64cbedec3739c52f4d1f2e7513e2b1ed667f6870a2130f3
MD5 22d808feab2c4b9d12e59e31e6a64999
BLAKE2b-256 f7c505d96332aebd790a40b93341dbc92da95b0b7b14c666596b56c90205f848

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3e64300ecf385ff57f5d92981806139c4c495a23ad29a8ec2ff0c904869ab1cd
MD5 e40808b2a2b9465fff1d1118593ed568
BLAKE2b-256 6e041852d3eca961e69298e8fd129cf163c9a56ba524d23bf8db12166048786c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7f7e28a28908216a3f2731b37e0f313e7fac76ca039793a8204d379d7f27397a
MD5 17d7d04b5e6471b8d300cc7fa2db253b
BLAKE2b-256 48c8584975e3e455f6ab1ae1c38a77a060993bc20b20a34ec3d550ddc11325f4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6cd87c5ac2f60f7595f142d31e81ad8d4f358bd97fffdd53f9026c1217601665
MD5 232f4126d4521bc7aabac2b05c62e028
BLAKE2b-256 40f5dc493a5a52018117467ae0aee636db6d3ec515e32c5a8a30d6aa8e9b29c2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5944de5f08e100013e029eea52e158cdc73f8fcb4e9b29ab0aa51adbf7098943
MD5 52d7983202250f1f7fab9af03fb67071
BLAKE2b-256 60f93c71fa8b3dc41a0e4033d1a048a93e2b072d6d90eea95b90dbad3e69c8a2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 201692b40f51bf746a7f67c5ee50bae0084aecfe920809e8121d337340e2d116
MD5 e636dafa4833db5eb4cc5a4bba7c1f92
BLAKE2b-256 af735a6b82e1458cbba0048ae58319cd08169ab39af885fe9dda8bed1c43479b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f332fcf5c7d2ab73bd0eaf8f79ffcdeaba7043029dbefc2f6325f1af648b596f
MD5 326f242e4d45728c2f03b9eb2e133158
BLAKE2b-256 551c048ee6967a9bbefacf718731773187e9d4322159a960d229b0d08854cc4e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c64cf2b379e4d81ee79f5f2649e62db6192a9e3ac646255924b5eb2033052ec4
MD5 9e66ded3fc6ef5eeb161e442e0cea8a1
BLAKE2b-256 47fc08187512a6725b908a10df6d233c451e7bacd90d08dcc5f26c128a0f0b46

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4939106c83672d1ca9b5491394488d751e899b7a77f56535ad3b7f708330e8b6
MD5 a8534e58902d84025a7952b9f137c15f
BLAKE2b-256 039a179ff4a0f40fe797c5c29e7f40aa64b28052fa16d69a4f7ca98697d501ff

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 acb71ece16b4250be2b69513cd8e56b06065f170bb9a57e13fa7c7afb6cfa023
MD5 ba17a8e696b4ee7bd4e63ec83d8453ac
BLAKE2b-256 e577c9d9fe870249290c2b9c8b7a049cf58d083b5f0db2b8dd098c093ef17bfb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 38cf43354dfdad38b1129831191a7b635ebdb1ff5bca4d15f63dff5c7bf7d362
MD5 e1089e5d512b62609e068189808ff310
BLAKE2b-256 2c45d1fbf9be1d265ba1c8afedd58ee2e1ea92468c38d99199f7920164c765f0

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7d46eb131a857dfeabe3c459bb194d9677e26b40b17030c5ee51684c206941fc
MD5 9fcad6585cbb193da9c21b654de0bde8
BLAKE2b-256 09deca27af9ed7fe5f151499c6f62a7c68c9af0e93432aa3d68a10d9c3638365

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82c04f93a96671344fbb5569aea3e4638023232a5cbdcb39d93a672e1999c770
MD5 56e15e02242e20e8e19f2d623fff20ab
BLAKE2b-256 a357dc5128632bc960fa891c97b3799a225214b8f01ec484f689e9b6a854203b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.13.1.dev202405011713370971-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f783b0140d585018ab59376a5891f487dfb0a92e20156d1b8dfc0896a3f2da88
MD5 19137738a750ed1f30bb1c66d16a75a0
BLAKE2b-256 bd03cf20c4e0e32964ac6e807a4007008530ba28d3f8cba3c9c22110f8b40073

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