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

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406141718113029-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.dev202406141718113029-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.dev202406141718113029-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406141718113029-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.dev202406141718113029-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.dev202406141718113029-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406141718113029-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.dev202406141718113029-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.dev202406141718113029-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

pyAgrum_nightly-1.14.0.9.dev202406141718113029-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.dev202406141718113029-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.dev202406141718113029-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5ab3d7981dd3bf7f1012145a3bbbd90f73e31e98b0affe9ade1fdb70e279fb64
MD5 a4a11424223fdb2d4e990289ddee4d58
BLAKE2b-256 2e1e5c21187d0278a43945610643ecaaa0a9f05b0c730a92a6e66d471f2ac2fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fe849b4d3881ffb866e891936f0de1c8764a9227cf4e44676fe0904a6a725c81
MD5 b2bf7821eb140d6dac21937b18b79c90
BLAKE2b-256 73cb38eda3bb62c3d4799d7e2ed762bc959aa334cdb33728ab37b4a0bc082ca2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 222dddaa60eb1bb8f3538de8e0a1362ccbe22d5ccc40c364072630cd51520e80
MD5 bc2a5dd46cd2f29f91836d846ea413c5
BLAKE2b-256 5a28ccfd5eddd3f4f874429b3ba078cd64925ebdf0eb7a6ee2828b06d1b2a015

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3d23e7a7366d8d3afff6bd40e39c2ebfe159f54ac86af17bead118e0b509f13
MD5 d9a44c4b0c37bfd9f2a2826a6a832713
BLAKE2b-256 0ab74ea2933093d89156bb24cedaa0246c4fe59ed0db7f0b709d163f85f3d207

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b3a7014bd39c1fd920192c994e60d0b11add6bb4b7f7b1e843ac07d5da68ff7c
MD5 a028273973dce0548611a513f8d8c7b7
BLAKE2b-256 13f903001264bd676df59a384fb065ec724dd2908f2ad1a5fa304c8c33eeab62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c02f36329e07b2e5e802a2dce7f66ce17eeb1ebc4b8c87ab2d43ddc8f1d81fd1
MD5 228260615372b871f324639eb2070797
BLAKE2b-256 a666eab7c4abe1f226856d04636f44a0b6eaddf46517fdf4266479d8ccfbd43c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 50f0ea396a3bcb712747d7c60f8841ebd681286f71f171023048d1eec64dcff1
MD5 04690b9fd105e2b1d721795d2860c98b
BLAKE2b-256 d90bb740f1f2bbd4719d330eade04d6aaadcf94ced90bd78d74e13698e6e33fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ba723e2599eb187774aa09260db538915ff9c0c30cc53982efefc1f6ce962798
MD5 4a7630ad36f2f98ad159e641acd7401e
BLAKE2b-256 1e241a54612d5dcdb29a4d1bde2143e3d72689940e2a797376c73795e4ddd9f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fdd47a0606293ecedf22b057773db1bc269d4298f63df3675d140e3ec027a05f
MD5 631f60bcba7e791bb936574cbddd4a20
BLAKE2b-256 cab099d11aa0f341dfb81c20c957a4344a42149cef1cfbea6e029f569ff617bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8acecacb7f531ddf79aa8c981d59026407380d3ca1f4a2813dc51898f585dead
MD5 e3ca096124e642dd022c627eef821d40
BLAKE2b-256 7de3ab1615484e1980b735a205dc52062c7d3143f2947815fd84d936ad4f6ee2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2024b1df2ef25c4170f5a66accc6e763fe71cae76367dcdceb8f66c4e438117f
MD5 98254f2ead491f16e83ccef21f014b8c
BLAKE2b-256 4bf4529c2b7d6d53cd82a3a3bae10d8163deefbf2d3951c4a031ce31956f7a80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f54658b2c187dad88fce104918e23a34bb048d4fa23a249e43abad2f2ed8513e
MD5 c25649b16e7d351406bd493a77f30000
BLAKE2b-256 1e85078cb54ee1f82f2071f71a7aba71eec4c80a531410e2993bdb0d61e67673

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 578bd30999f0496a914ef3fe059499fb67e0a9895cb9b4c583dc1514f29da5c8
MD5 9315629fa961fbf3cd0be8b738538f1f
BLAKE2b-256 6fd509fcede57a089fc0e3bd66520bcc5408713b59fa02df3198310a1388c021

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26ac37e3d4bc0261247f65827c1af6d73d4ca6a2d8cb6c117cc9e87515f1f841
MD5 612edb80eb7af74a88cf1ce98de414f1
BLAKE2b-256 c829d4317f90fea37f1043a5cd45cd8a346d69163f366a139a96280d38465b47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5d74d49b88ba5bac29944487ab4cc9f661bd773f9f71c5416cf5206171c3d698
MD5 2869ddc142f35f2faf4388f5883c658e
BLAKE2b-256 da44c8ac87307f9a29b473d6f41621db21b08760af0977b9d22f33dd6fbc204e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 08966bc2b86dd81a6bd20209eb5ebc206b2bd640ccef4bb5afb1ce1870400019
MD5 285ce820b6060b44b3f9dff99ad2d0a3
BLAKE2b-256 0e82549c2b6a0c8b8766e4f521f80e21969d5048eef4fee17337112633ace53a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d08cabfebff3a9000cda1d304ca95ef0afa21eb149c041d774c4b5b4897136a7
MD5 3166ad347d0b3d1e162492f9ed2ca43b
BLAKE2b-256 3a5ea66371262cb301669eb638d0e7f1a0bb97112d1d754a36eb5073913017c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5f76fd5fe9660415d641a8be64edd9b4d716d8a43a6a15c1f6089308b17156e1
MD5 24d43cf13107c19680c35f2630f64c38
BLAKE2b-256 c5785fe04033228666d8261e4a06c269ec8712491be447e1274aaaefa6ea48ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f7d3251eeb521f23cb4b5909208cad585fb1b336a270ae942868baf7e31c991
MD5 f91ce29a0f51aeaab8f79a74525899e3
BLAKE2b-256 6e5f45a0c12b809cffa530284c5dcde0f512c67b51dc088e10a3e322a38dea9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.14.0.9.dev202406141718113029-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b9a3ba99a7418b0f037ef346a29e829ea2567ba748d4c973b4c92d48576c801e
MD5 9dfb882f8db7c88b28e0480de4bbc92f
BLAKE2b-256 1a4c8b44881981ba557ce75d7a83a83749ddf0a9159ed66729091acb19d95a96

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