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

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.8 Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f3e5153051cdebe63761e9ce690d535c4ec88963c19ca072a00850c24653a277
MD5 b33ffe23bb1f6466a6d99dd635e63666
BLAKE2b-256 fc0a4a54096f10beff7addfb6325a64e16c7f8fef47f3fd848b3eebc6b2c16a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f0d235dc7a3280f651197a86467036854583b80d35ce8dc6d455eadda68316e
MD5 483ba6121a13427459d8e11b5cdb1b7a
BLAKE2b-256 b90975f72412eefca91cd6d6fb2e33ea99875ebb19d6f0236166b59a354165ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1abfc6d4724e1b1ccf118013ea3a6ffe79c3a4bbee492b4f499fc20bc5e5766d
MD5 639e9341838f5674fc865b165c678695
BLAKE2b-256 72e846e228b196210eaba22bc66e97374d33da82955b2769d4ab258dacf61945

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b50a875c70677e286568c067bb236c9af8c977f2aecdb199fcb45273b0ef884e
MD5 75572e774375ff7bd917ef8ac0776170
BLAKE2b-256 c92cc81f7ca8eb749087190dafb02cda0db854e4c843c0ffdb99368800306a13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5fa284510659f5158ac501c01a3d9acc1938dac1189207c6bf41484e8fcd2a55
MD5 2b7511db463459d5d1c98537f255a460
BLAKE2b-256 e2496f226597128cc0dcdd140aba58c30c77b825d3fa22069d2bb2c8b200b707

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 92730648d7b0467697ad736e52301d96ea86c12339f895e0eb4cfbf2c55b7c1e
MD5 c396ad71c4a12acdc303f309e9401887
BLAKE2b-256 7dc529cd23467e8c5288f17b8d122ba4e63e4d6ca7d7c23af9c2ed5c23748a17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ec126a46fbf1b77c5cb90822a7842874213d6ff4bb9b0ff42ffc6ebfa1703cd
MD5 246ff741934c4b476ef784cefb1d1fdc
BLAKE2b-256 b592f2e29054a9b054bfe804a87529f9605429f0949078350bc2d3b7b5005a57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 34117510852fc7d62356e3ff80b45786fea596c55bf5b7b96a4f9c0e74883285
MD5 bdae70fd2fde5cab95728b174bde61c1
BLAKE2b-256 82166369d4f3467b94ff818748737ce9c2804da5f0abdf3e20a9fc07f252a586

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d46937cb681002c855a9a24ff76dde53c4278da63bf982937b81c4b43244b1a7
MD5 ed7ce27a2dfdd445e87f4d66cf842c5f
BLAKE2b-256 31961766654360130178f43280554252b41068fe319b727e98584ee2ea3a3855

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4478551a3bf140d6b26d8fa6de73e0208932099999c35ee942ff59c8e00cef09
MD5 c117d089a90f4bd42b3b8f9a8474a298
BLAKE2b-256 91a1923719909b5ccdaf5a9a5122ffdc62929f8e2dcac5bd81263c6b6e0af470

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 eab72fa75e790c9d74bfa37361cdc9a67b8e28eba4c1f8e246be38b40b5f6be3
MD5 9ba5ae4b204145fc49cfa39c39dbb1f4
BLAKE2b-256 eea1ef1ebcda2dc8a61692701ab12ca25faac3d268e976842ee38d91d521fec9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 14b3f4289117b3e053f4f8acc402c584817250091111984768ef3da65eaaf83d
MD5 c9b41e1b9c4ae7ada45fefd24fb4a971
BLAKE2b-256 d530c74c477d5206bafa2287f1c059ccd8de14b31ffa0669848bbd66f29c49cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 80c0c22e3f36cf68f7258af9a5d8d2a4627e3ad41c33f649e08560ece568338d
MD5 723a52522cf495634f7523b77740aa7d
BLAKE2b-256 f1fe7e6be71fa320659e0c517aed4d3cedbcb053467aaeaea632e07c01bd4a0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 34892562e494c62ed6caace136212731fcb4574ad0c5132afbce879306fb64e6
MD5 47c94d60cc06094cbcebe61073fa5a37
BLAKE2b-256 06072a4166403083679fb79865373edb471c41cfecfa46ba166f8cfc1680f438

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 05cf4a1ba3c5bba5fc80c7c1003760ca53e6bd272fccb46082c2157e0e1ba5d1
MD5 a390f0c09a4c86bdf85d31766d1fa7c0
BLAKE2b-256 96eef215ba8b69e45244167b54b86f10c61f5469020862fa79000203dbb2b425

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 31451f23c9c4704696a1b958443806b242702c296e933874776e2a1a24b6f181
MD5 421cff210c6376af411f94e297806333
BLAKE2b-256 876e7209034c1709269dae499341fd029799d30029129eeb1e74bb3aad5078d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f7d919d88c60b4c91d874c5eceee0b58c9ba0daf51170710f7c321b046abe091
MD5 ff466c72e11fb6bb501123680c8274d6
BLAKE2b-256 af5b79a8e4d3e94c3cf9a0591af17630ca9c554d8e61f7af69bcf4257a61a470

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bf86c91e403598cb6078ec4748f6bb8ca72ba54cf82e111808de44a51eb2e471
MD5 fc7fcb212779eb8da953942582982887
BLAKE2b-256 a3e6022bb5c1587def33ff420320f2dfe6d6f7f3eaf57af2b29799042e7798e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb33a5583d0eaf24c5d4dc417cd396024f0b8fcd0ec26aec49a2ccde2e1d4300
MD5 390d41cbba382b943c95ea2665f0adc5
BLAKE2b-256 e48ce74b7511adba4e2b779f5a53e3d9a16ef0d7da52f99740210426c81edfb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8e85015d4ec9cb6d1a595c9477a6c7edc2c63993af0e644edea993846e11df7d
MD5 1fcbf605f5ae52ddb2eb809386480d16
BLAKE2b-256 4332e686c03ad8bca7898709e6776718c367c00458fc2ba9b7f3bd7165ca1624

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7d34db06510f1cdeeb46b7a0cd4b781b4e10598a2311e2f63b3b478f82d4adf7
MD5 866a94b26d430e83fd93723ad66a8cd6
BLAKE2b-256 1842a0130b4222fe1d179c6a864868f9de5fb319d87eb8e910f572c3a762a687

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6a054ef5978fa8a49e64dbbbe177024af0b0bb2b257aa8d5f2cd0756f861cc2
MD5 df777d2a29973905902eca1a7cb0623a
BLAKE2b-256 9f0586355f0dbcfc5f0454e324666ca0c3b8d8148a489005eb90904835726a2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp38-cp38-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a3f7aaa7d4f3e2f1365b547d41cd2ed5c3b5af2af7e9d6479dfd07e13ea5f256
MD5 13f416ae8816a64d62d94bc2d7befc7d
BLAKE2b-256 8e8b95db17b7dea222ebbfce2cc5767b21512771027f02c6f4f678bcb51536cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 95ecbdb6627aa899ce32194d0c0e38e37fccd45f27fab06313d5793721088b1c
MD5 6fcf1363d026e49b5e359d4e1621f1b0
BLAKE2b-256 5fa2d4034aa711ec41d64e0cdd30ad55d253b2881c9e2aea417f31634f26fdcc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.12.1.9.dev202403191709747362-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c417b58c302da440f374187e345d0eed18935a9b3550ce43f85041f4e3dd7fbf
MD5 699b8fe676eb5c1b24472529df608a88
BLAKE2b-256 04b7454ee93d6e003804aff6bb03960bc84754bc3bbf8f29df4f864a20b33333

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