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.12.1.9.dev202403121709747362-cp312-cp312-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403121709747362-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.12.1.9.dev202403121709747362-cp311-cp311-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403121709747362-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.12.1.9.dev202403121709747362-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403121709747362-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.12.1.9.dev202403121709747362-cp39-cp39-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403121709747362-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.12.1.9.dev202403121709747362-cp38-cp38-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

pyAgrum_nightly-1.12.1.9.dev202403121709747362-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.12.1.9.dev202403121709747362-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2fa9a228131fb9a38cf5d1d66af21217eaf765d294614f7f7e99ffd53a334191
MD5 3f0e657141bbcfa6a15112214ad44e10
BLAKE2b-256 43f4fcdcfdf09327ce748fd5b1445a8ad63b09ffafdfeed4b9d19069429092ee

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cfa541fbd03ec460ae644a3ff841cb5de9c33ffa731ca3344a892f6dcc65bd33
MD5 1ed01210f516d850aa800fcd396828d8
BLAKE2b-256 ebfbd7551bd76107a1abc58a9de4fc5a92a7ab194b7d1bd3cb7ed57311ffe3bd

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f5a63c7177a120117ead628722a0eb7358a8b0067b655319b236cf769ebe639f
MD5 444cc9d21d582f854b3a4e72030c2e06
BLAKE2b-256 50df791c5084a0e6fc427117c884079391b21288ff37a4f79ecdbac66c00fb58

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ff6e4c05751ddd3f5e43836f8f3e9fbd37ad1ceaad64e3ad6c6374a9303b67f
MD5 586831cca36d900cecd4c52f14ed4cd2
BLAKE2b-256 d1245d9a881d1c3363f120874ff4267211d3422379856a0c2daad3d519a4d241

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 537d3c99fb04b3c0179cd860a5b66d3ec6637394cf34b249c89cabead7e42e4b
MD5 a661d44f3de5cdc618f53f624abdd86a
BLAKE2b-256 43ff17b73b7a135bcacab7fe0a19129c62a31c9cfe54df928f270bc53e61bb3d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1f75b2d8c45f61c6c9ca94f12d71a7c4902beff4b4f18fe509c7901cedff467b
MD5 642babce2e92dd091ce067da56c6cf58
BLAKE2b-256 a6162b13b2fdea7220049431338d71fa6b41285df62ab3ed6e2e310e87a9f7b4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5011952e86a53c496afb057aa034fa5b498039483a55588de778c1456f308529
MD5 a1686fbc1344ea2830142e632ab37933
BLAKE2b-256 fb9f43bae5b9ee11dc8f4162dadfe16b22fe783c7046cc532663f460d8771f29

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e9028939857046d142a5f329e12c44239959de862d584f863d10911dea194de0
MD5 a8b0dad4ed13318d418ee4e7142d3946
BLAKE2b-256 c846efb8aa4aaffa88ea3fe02d88fa1a5b45a36f7cffaa7db876596546b0bc64

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 02b8af868bbbd692aa6098caa5e2876117326842a658c9e2362eb99043798ca3
MD5 52b591237b033dce11065a5ab6724c41
BLAKE2b-256 b618e8d73d97b81a8de24da91e86705e49d5ed220ca0eebd4496a8f604e4f696

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 17b2e34bbabd76902cfb1f05f25cdc088da874220711c051de78ec3bb97709cd
MD5 cc45e9df95385567d824b3808292b1ae
BLAKE2b-256 b5707a8abb7da27fa7ac05eb96e8a44248cd9e242bba001f7b416b62befb4b65

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0a67f4ee26618e201aa1b064db522d444b8af89088616d3aff2687749c6ef14e
MD5 606f8adf5badccf0927734f27bfb6ee0
BLAKE2b-256 c1a48839d81e41097b4022503d8f65b63f8ce172da6e016fa0e474af1c8f8a78

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4a09d36880fc13ade296d696bbf67719b2f4c09a7d16d9c76f956ce716ec229
MD5 ffeab1d788df43089cdee1b4a8aeaa72
BLAKE2b-256 b9b9836b4f96605e735bdd13b0a50e0c809ceb18d6676180aaca13af46881a43

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c4f478d0e5ede99d3119183c86bd17180b51c02cec63e5a83eae6397c1df5f83
MD5 edf31094d56002f60a20ae76e81ffcb0
BLAKE2b-256 d321f237359c94b1401242538f2baf25cfa9b491a505253854c954847b070290

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b2c1580a0147b74e14b0db76368800859bf4cdc5bc7b0e459ba7d2ebee5ceb3
MD5 1173cae3d59fbcd004f4a917d7f24f8c
BLAKE2b-256 6e9f1d95b75a870a2a7e4587aa99b1a538efc19cf4cbe2f8b752d2c88e9e215e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d6026e72cea3a718526e6f5e68eb32aec3dd54ed0eb1bbab085f2f2bf9682d60
MD5 a91fbaa7e8c26e3fb6b98127e3b26f17
BLAKE2b-256 7e59ea291ecbfa3136bb1ab737e3a56a0d1310a02d020412f97379a565db0e78

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 cbcecfaaf6b8ed21bde9fc07e2b455d4ce8597c0cea22cc6df744ff061d0fd87
MD5 bf3c5727c4217beeab52cb89b0716c9e
BLAKE2b-256 33937c088991bc8cbb89dfe2b72af6f7a60a9324080872537345b3a140f71c9b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 96f34732aec81ef71dbd93bbbd6dfecf730a2a1dbcf40de7c2840e70dc2c1042
MD5 1aac718c3b8fa60af1db09c6ead8e5b3
BLAKE2b-256 3d4ce3d3c2fcd24ec974aa7bb938914f7804029b01b7ff1825883830d4abbdcf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 50a87f5d825d463ff1621a708e258fe23b8f2fd7b1eb633364f2a62d34852373
MD5 daab035976ff93c87fbedf65dd50ddbe
BLAKE2b-256 244b0f6238deda93de92c08bb802c9ee1c17e825d98c49c58869de07d5e948af

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6c033fd4df4d53068dcaa909999c32acf143717bb6818c8d0f834963421666ee
MD5 199ff93e9dbb08760ecdd1f99778d76e
BLAKE2b-256 2a6659e318b59d9938957645624c10252233624a878bd93073c528cc2a4d9a4b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fb7ececd95c48e0cfa8b4027126738aad01b3db66d04beb540a049eec5aedae8
MD5 191197adbdf7871334dd732e4aa86383
BLAKE2b-256 1d11bf4bd8f36b0085ac8246e759447096ed2c29b1585883392d000a72b659bf

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 664ef68868b046270b1ab77c7c8c9f03ac9333ff13622aa7bc112176a3bc2230
MD5 57f8da4177d2e54e07e86ca423bfe8a0
BLAKE2b-256 6b5adba0713245a9a57d7ebd4e1bd659e09d6a07ef87bdfba1609c6a1780dab7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5bcb29be3145fcf3949d9a39bf654a26aa37b85c2195e559ce6e5d3d53456bc
MD5 05dce0972f731fe7ee78ece2014516e6
BLAKE2b-256 7bfc88d8306882d06a03d7de17ee78a86e9845f62f1e43dc7958d4f1bd110f07

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 85669b2ac37b0f95d3ae07f1a73edd2a23a638a4708137794fd43b7475d8d9bf
MD5 32f07999caf8cbb7c3bc334b15be0907
BLAKE2b-256 6da120fff4cea573198797a45a607073f05321b5eb2595d844329c4ad673d716

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cf8847753bdabbde158fcc0169bdc7e39b0587cfdd6f98ea080712e41d23f94d
MD5 ce1e31a1ba08ec4fcf4febe383dfb50f
BLAKE2b-256 9b11360655db97016015116d815534fb252c41a5dac8c930906175f5a580a78e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403121709747362-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c1014a0573c84c14ce7d0d0f2687af3e636ad7c8d0cd938ba58cfc03c9384a60
MD5 8ae04c0f99054df52f6c0e78cdc6846e
BLAKE2b-256 694e5170841b82bae4245f8163f59dad23719a89f0a4bdecc505def51aee9dfd

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