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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.0.9.dev202408141721169663-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.15.0.9.dev202408141721169663-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bc9a655f44b2d2c763e3ffaae68dea91b8a9024806101a6ac32412925812517d
MD5 a5446c4a7880951cc5b129d4df6b396b
BLAKE2b-256 7425d5fc926d229ab1ede3b657ea86966f0d78aa77eb0ef4fd0a79005bfff374

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ba898b5b8dbdbf2d81abb6ff3e1dfd55fd11944f896f03e4c941685adbe4ec8
MD5 cc25a4fd1a5b6d8bcbd96088aa7b7560
BLAKE2b-256 70320e9d3204f4c245bb7587f6d340fe7d77c6de5023d754618ce5a260ec4512

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 39a624fba43e311193f7378be28b766acddbba90d6fa5b05b91d6133906a185e
MD5 15b76d34afec96a536c106ae96534666
BLAKE2b-256 43d48a3c36c2d2c1c0f345813a425b1e66bebccbd40eb31fe295aeaa26001602

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aae6b23becdebd67ee4de17d6f98972641675a91660f37f5ea6db37d3c872819
MD5 0f17107329b89b3a39833d2cb8d177e3
BLAKE2b-256 2a08dcb0bb40003a5e31e2e0084aa16ed64f900fb47913bc8d2098d3d0e18459

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 48e6ad5874b87748712c9e6e1cba329c6ebc89ab520f895d3f681855a0d82577
MD5 517724b241571c1824f2abe7fcf68108
BLAKE2b-256 be46efc8eb70b432fd153b00c87feeb04ca589d058eaf51562109f865cf8d035

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3f8799833d69d3d3fd145eded6b5d4b63862174285da7922fb3869f70009b111
MD5 b2dd2c386dfa1faf9203a49fabf4228f
BLAKE2b-256 add4ce1dbfd9a1573efb12c38a881c74e2a79c0d02afec532aefd9d04d1512b9

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a2cab9eca5f1f3a00a7dc1f0a1077665c7052395f312bec7aa5d8d0caeb71a70
MD5 8c4a62e14d93b484584159bd135b783b
BLAKE2b-256 e56f258cb0fcf9340299c55329b960e86592612a718bff60e4c68303190728a4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 43ec5b9b804e0b5d756b2c5acb55ad52e6f290eff9b2ce8e9c2bed20f777db7c
MD5 0f5d9adbc4ad8874b00724f787f71d33
BLAKE2b-256 6730243950c105d5baff2e1a9ca93816af64848815aeac7a625a00d99c3d54d5

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 478d9c708ac730935bdb045b46af5ec30ddb06068ce8b16df70b784a7bb5ded5
MD5 fd89e18fa7eeb0945f3055df64337326
BLAKE2b-256 7a7d6b6747b0397bfe507e211726b4fe6b5ccbd63f7b1dc1911204f96f7c2ed1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fe34d7b73134eb982e633b68d8005ecbb95339a6687b8d0d3d87b6c123a25d45
MD5 77a6e610dcea100c3ddcf609123ab195
BLAKE2b-256 49a4eb45c50b78ac878817e4358778996e859616f7000f4840d12032e5ccbdcb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 15f3775fb9e1fe752d950c02c3607abeb811bc90f1b3d12a4a7d05784727fe69
MD5 b160b21b39bd376ca29eb2cfa40e9962
BLAKE2b-256 e733600b9b94f476007244f6089213be276e82745ee64b0002625bf51922d639

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 70d9c45ba5a4b6b1011a49ab0819ee8387291fb78e53259f06f96014dd746f8c
MD5 8e1f68a9ec1c003aa86415fc4b4b9b3c
BLAKE2b-256 a23ee88a55b4c5cd2103dd8b4c13e023a2d1100292bcccaec7c7b8445e0154cc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 71d3f10be828a4aee825ebe98720de11c50ec35efb57f576f8b40c7decb1e6cb
MD5 0e8f0ee0f8950b93b83b1a2541418492
BLAKE2b-256 285bfed024f8b239ac94b37a2a7730f0f9af84b41dac271e94c74cf24e3fafe7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9784d87eb705b7258a1b968e2ebbda7dba993091a3f0c7bb3182983c3aed0966
MD5 1e6d8877ba7435c84785c5e5a716b790
BLAKE2b-256 6f08c1ab723a7a425cb7d5e7e2e502d6ea7c0c6874704919d92e33c0bbcb0319

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a8d646a05faa248b6b6e1e1ff83005ce76184620688253e58a86942ad7936072
MD5 59b5deed00fd61277089a0b8e4573e8c
BLAKE2b-256 cfe9a3a3be8c236bac4fd21ba752982f184297770383f5386beead9a2a10c593

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9fae7c93b7e1da3e6aa25f60894a3ecac96662d64fb9f43b099d5fbf1ed85ace
MD5 a00f7cc3c7ae804b9f4ce1c7e9a10fe8
BLAKE2b-256 aa6a531e9a951af5f091c0a4c5e6a306939fe265fa44ad0aefc2feccabc6e67f

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f765aff0c1b4933654ba5043ab4c3897a2293b3307f36f07cf291e92cf35e54
MD5 bb25ce231d7a7c328e2687419b5e96c2
BLAKE2b-256 a59beee3ff754119f2fc01e4b6f63226cfc93b826ae3cac5855988c98bebbdf2

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 306d86c5ff5b46bc5e7805d8c070b78749ec446ae79ec729201c8e7b209eb74c
MD5 73f1a86b00e8305a6cc2487fbde752ff
BLAKE2b-256 d35ffe7c7281156e6482af9161afb14236795f88f38e0b9c2bdb3da91e43d504

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 54c24ca2ecf2292c6123c86c6f25a154db9b60e73cf953a38f2ae2163df70704
MD5 305e9887c1ecf845c7c929ee39a6b08e
BLAKE2b-256 7341b5d4e34abb41409c11b32091215c7feec0aeff72eaea5579e26837169a8c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202408141721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6b81de309775539d6255a35768b4c49b737a72b13369cd5b1fb129ef8f86d740
MD5 624c12b12f20a8c662f52782b402dbeb
BLAKE2b-256 f83ef7091aa4a10aba178da4f05a4d690242778d62d0cb041641da6b1d2cf76b

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