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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408281723794729-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.1.9.dev202408281723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408281723794729-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.1.9.dev202408281723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408281723794729-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.1.9.dev202408281723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408281723794729-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.1.9.dev202408281723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e5e9e530fe450b2eff7ff0ecc687531b916ff5d99bcc2ee551cfd1efbae1deb3
MD5 6de9e8c76eabb25f71d73a7c26bad2ec
BLAKE2b-256 cfbbabed012d292187e9022942b94e9c21f27f62564039e1e5666e1e3ad90644

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eaa603b20d06f52f16d5acf121ffffd83256b47d767bc36e5f66d9427ad3c5f0
MD5 34d2b23690b5575f51ef3fe45fbb6fe8
BLAKE2b-256 c5f6120071027936f09605c3ee5ef6127fc76cd96723745788b2062075bbc495

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e75ef38f71ff47fb0b082acf80270b07fd7dd678cdab0ad2e08f6c4f53c45b52
MD5 8f1c60f46ae65848d19af70a88e3fc3e
BLAKE2b-256 22f128a9a16df4d73d28842be1737205a7ef67c23d9b846d0a7e842e5d856459

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bd4e97c0ef4ca6af03a19b0a263b4ee24760880d44eb24e044b703ec33cb14d
MD5 cf5232c8869774076666df0e121f34d6
BLAKE2b-256 863cf8215693b878bcba741f7d6034424a94cb9bc0e7fd2b62e4f61a28811e90

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a7eb4be3dc0d9a3af48108f0d05a3859a046bf4f44e7c2f58fba5f10fae4cbe0
MD5 942534ef5cd07ebbf53299caa7448112
BLAKE2b-256 9a454d77635bde37d9f0ada79301686f9ad26ab207bbf73611d22d981d4ab5e4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d1be926453fd44d8988a7ed6d6fdd6f83fe1ea84908ed6c4ef9ffbd83d204896
MD5 325338040cb5634583d032585e677b02
BLAKE2b-256 af452e6e07a77cb7abd3daab49eb45c4a530cbe2a8eb92fd47a65b222db9813e

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d34ec2649651cb14668c6aa21898f1a4e1449ca2b5f72d7444c1728ff55f49e1
MD5 0066eb2a4b69ef14bfe0a6deb57e9130
BLAKE2b-256 fac90b496aade6ab40a7b376ea57fbfb560221a3f381716d454ad5e1d8e23336

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fdb228b2a0af8c7276a56b2964b349da844f8dc5dd2feb7b43e5140f59993c4f
MD5 00fbb460f941793f4cfd51d2b6e3928a
BLAKE2b-256 c893a419c4c15cd37aca70da177c3c6eb0e19ce8d9a583078833c877a3673d40

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 81424110eacf4a483a8448bbaca0aa7cb08738ad494229f23b3fb4cd29100db2
MD5 0362158adfb3085aa0665229df01ef8e
BLAKE2b-256 5d6ee121d2517ce5e0a9cf2949788c256b0955724deb1b4cb765b91a319950ab

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fb120f1e0f1be21453c0fb98f2243a2826039eada35313826233672ebf005abb
MD5 307b67ba90853e12967b41c7b314ef35
BLAKE2b-256 5e2b4344025de22905404d2a01b73f01eeb5d8bb4308551e522eb00b038c1d8b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c092c5401a29df78f038254eb9fe873773be138eac0225a1195b356fa65cf3ba
MD5 710aea48295a6397da7358a0d0aabe4e
BLAKE2b-256 eacb3e3328081dc06224fae8593caa5976c93ca8bc01bb2e1e6d600e3b32a0f7

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 adb3421052162e5946b1ee204d04c1f9b470dda403cbe134e204d46c56a86764
MD5 ba531a80efcab2fec024d3a2d8d1be5b
BLAKE2b-256 26cf944c79bf5726c2c2a7822b72b4de033f70082f459de6e64d7bb8ecddbdb8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1e28573586003c7a323525a19edd151aae5d64075b745b69f81f28a77e9cf0fa
MD5 f675fa10b8ee2005281930172305370a
BLAKE2b-256 6c84c13dcfffbe218ebba8fac9ffc3f05d93926b0b38fa8c3b7f28a8cbea20f6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 209e917f72ae6dd285f9a982fd1d0835bd046c4b33b44601fac080e67a63aa41
MD5 0f1cf6b22503851043616cb2b4602718
BLAKE2b-256 0bcd9091dc00a8098402fc2b3ee66fe4f323c8fb54d70deac137fc020383e037

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4b35e07b204f9e498f76654c1f65bd4614b18bde22487b315568459f275ead94
MD5 2ed65153f856c4bd03b664b2a4b379ce
BLAKE2b-256 549eba2c3a4e4137ff2991a887e7090a0b7cc5a1911418c4e11c3858c325a198

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a60b22e67d4b6220da521adbfed20ba8bee9f9b800bb4f0d34f8f9edca227b49
MD5 38b7be60f1a85b4fca509f5c4ddff2d1
BLAKE2b-256 017ce85ff02192a5c5eeaf91db269b40b32d3e653e885622d59776424b7875b4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb1a9f6266ca0adfecc506ac34c71a9a1ce3e9169a7db15f1f7c825117d9dc9c
MD5 9f2efa48a30b2f568a11052d94321013
BLAKE2b-256 cc998ca42aa3f4b623d8f34121a5b62b14e34274add59239fe52a593a9bf4f60

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 89911ae28550e1640877c0a2430f5b8d934cebb269469227e4ab44a1510cfff0
MD5 d989078a57b796d6ed9194dfa561f981
BLAKE2b-256 0a9b92d21f227f73ab7c2337ce0f38c95085ff07db7521e3e05daf2acf968d5b

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7dda55cf6816875ffdbe0336227453c3782019802f722a8035bc9747b49563c3
MD5 3b9269b92281553c5a411d2bb8ea89d0
BLAKE2b-256 e928cbe3e80f94b914e421b38fd662a56228c356c136e565c9bfc8f1622a4c74

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408281723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 851645c32e5e0614db1ae4fb1b30c2466e0cd046101d38c4c282b0f02b0e5659
MD5 3a36d442094d2af253dd681c08eb804d
BLAKE2b-256 717a5c3807f969c4dff8f6aca36c55ea5883b4213817eef50dd0d0b43029e6b6

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