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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3f60760dc6e9891640a18bb38264aada12336fab946e583d8652179437a27d6a
MD5 30f183edf955c12401f2bb7bb3f374bd
BLAKE2b-256 9b12e1afaf31ccedf3a1c026c3d3430fe0c05c54ad98d16d4782a68d91cae380

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9363443d55d781c239b433d196762e2aeb4e4b0eec846fcd2cce60ccf8fbf8be
MD5 ff08e29ad3e5fee87b5ee35dc1a1be5d
BLAKE2b-256 01a9b84ec186ed83c508c9c5977b979f0d715d85fed07977fdfe00cef8f90dc1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fb62a9642119d10eeca835b2916633055db8362155dee616063b168176d28a84
MD5 ec745b7bb3c0e866164a9659218dd10b
BLAKE2b-256 f6b703011852c2a40ff40cd42f785080eecac53d6ff75249bbb5141689e400a1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49d996b3d8bf76b38cd3101b277ec00bc5851cf37bb87657d82403b50052b036
MD5 3dfd8347bae36dfcba7fc3e9eceb1dc6
BLAKE2b-256 3a787e3887b75516cb26937d8412589a9a37098120f6260a6ce1498e91b69211

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0481dac90cf07c5672fe684a9d252147dbeafa08bcd03ffc56d4c05cce25f60a
MD5 535f458e1589f590a876c3c83089ef15
BLAKE2b-256 f9f76bd9509199716e6e5f1624e4728c831c224a4e4042797a95b25396fd11ae

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f41bd10e66c5db9dee71539e3e650e7dc8d74199c126707fd2688724ee181f43
MD5 d76152c391354b595a6b0cd09c75d1f2
BLAKE2b-256 a4328951ce53af43147f2d17c9800fef8a99b631b0c3dac42fc55b0259daea0f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7a7ecd3c81294951294ad726b6adaf3084d55475cdff4362a30ad67450089d1
MD5 b8212ef55caa43142534d9f5daddabe2
BLAKE2b-256 61b84fff71d7a320d7d44fd0db0f634856ce82bb55955dc906b6cf18e5b2ba10

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1436145a872d5918b56224f541b7648a38bf92f153b200c205e39820b8644960
MD5 8cc4e0c56e78892650e9b7286d40ba96
BLAKE2b-256 5cf1408efeb224045005379cf2e3303a3bcd6742aa0238e659a0f93b31d5c76e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4329a7be37f7f22b3d1513e9d8f27eae164b5e44d3cd00db3a2d0a9b1b59db48
MD5 ccc12dc5ae06f5c29fe0faa38e8656b7
BLAKE2b-256 c203a259b0906fe863c3d8250fed0b24929fe4aed0d38486d31e66cc95bcad01

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 77643e6b2361623a0375bfa3b25d247e250a80e01cbbf92ad997d5d9aae5278c
MD5 faa2232105c962ea211038a27375c178
BLAKE2b-256 1177f9b5a8c929f0e8ce3f502d009fe4b828f1f50ee77deefac929c506228ca4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ac271fe6f91aad5231ccf63ee34683168f4a91bcbab7b9da681557fb115e5c07
MD5 a736a7803b585d15efd9769a014b258c
BLAKE2b-256 872e7f7ebedf7f7e4cee165fd985971cf8b624a2611ef7ebb2fddb7195f37a94

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b7e9b36108ef7f241307fc16b12f88e930fa7a446aea77cc5555a2ecd9b7d51e
MD5 0e3c3baac8641207da1b0c21b11ca8ec
BLAKE2b-256 98f3cb12afd269b465d788249875fa4169aa46f3a9b652d59533f0758eda1e08

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 42c82c92126086cbe6df7469748f3ec45814fa251e379b5ae8fdfcb9e4702f71
MD5 12e733120d0ad5ae92bd9fd73e09ffdc
BLAKE2b-256 d2fc635c6a024c22ad126889ac8258b60b3f9b96ae5c1e1ba7fe3b5c13abf19a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 85bc7549adfe07070b03e577d7de98d02c04e1f558a7cebaef235fd005d149e3
MD5 86ad3ff03fb84a17c82074a3ccd833ec
BLAKE2b-256 0e1c496f2a0c4aa752c23d9fa94ade17b16b51377aecb94885e84fac87f7ba5c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2b37b23eabff99d977b7cc2d635cc5e3aa12ec6f955871841e511e4b4f52ed30
MD5 9d3ba2ae36f68d6063e5e02eceacdea7
BLAKE2b-256 30fe699260a6561b431e698715a47b94c3ed15707a5ea7813551dd5261c611a1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 bef51c5c42b17efdc741f679425e9756abb3ca5eb891a1a27c9b89b0d19631c6
MD5 ee9ddd36ba33a96c11325acf6fd208ac
BLAKE2b-256 131854405295cb187436016200ed835d8aaac2ec212328721294194050333aac

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c8da387229130cb9020bc5eb5fcaf92b3282047648a982d4cbdbd572cf4eaa7
MD5 9aad5eaea5895d2dc45eb44951ba0ddc
BLAKE2b-256 b96e2247ad871763f91660a801f14b7d9379fd45293d9f420684f6e23133b7f4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c7991361c6bad39619abb3dd687759c1f135759172d9c7f09eb811d05bb6e02d
MD5 923f51b79e1ce762836e870ca1e3d189
BLAKE2b-256 48b0220a2932a7f2910ca785dc921499b4bd2abfbc4a806d314c63a060de114c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b54c4bb009f2ec93369a8cbaa32f51e0b3b347fed3a98517198e51e25358949
MD5 52459dba3af7b8d9f025281b6128d5f2
BLAKE2b-256 b93d7f5b57be21cd12423bfef7bf3ae75953d92f191add5175dfb157e03e64ec

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406201718113029-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d4d64a697d4259333e27abef905640d11961692d37948ddd50e1b73685cd72f4
MD5 0cf27a2352ee27f4763c55e64d14163c
BLAKE2b-256 3bbdd540448cf2a7d3149746b4bdf0036ad92512a185c5770ee65de67e9b2158

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