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.17.2.dev202412211731932516-cp313-cp313-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.13Windows x86-64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5419b7987d5b566d55bf4db23124338a948657b50a88c1796ced322d78b62282
MD5 1f0bc2a008d4a264ef8938017683ca24
BLAKE2b-256 b10d4dfbfe09c45e8b3336638e8295a819db8f447e10b8e527bf1e7e03a024af

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae320c897f1f031b8d1456979454cd224ba8056bfd3a1a9e52379e300653b081
MD5 4ff89696c62e2116b90e89e6e531f637
BLAKE2b-256 e8bf00497bd5a60866c2b80203bcddc74dc5fe1b0f18abc76302288f8d8abc71

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6998b09a936ac85c5433a06c1729f2efa66b782c8f3de3a16003ac8f76f6bf4d
MD5 dddd72ca71cd52c97d4e3ef55205cf88
BLAKE2b-256 9be4ccd77c55abf51bb941b246e8af4bd66b1e04bccf7c7c86cde2605f26d650

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fbfb34130a2b6a38ad38ade3e40862cffa9ac56c692cc3371101f1bcf797b1d2
MD5 af49dd1716d63e8c73c946b16d59749e
BLAKE2b-256 9bf8933eee6048cde47d05ee45f16329904bd06120547d2b0687c78817a95b70

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0fb3748ee2dbc583ed3eab84ea6180cd1031d47ca881407e84ce34a700985880
MD5 7852f62a7657a3b8c14916be473cad2e
BLAKE2b-256 3cdb55f1d61953c9673c9a0274ce3bd83bc5a71efb51135b6bdef8b12f72f896

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9c77dd51d4be27a085ab87443ae1df697ee9b98d14a086b0f3b58c488eea874d
MD5 6adee41cfbfceaa96da31bfe83355325
BLAKE2b-256 5678a7a189ccb70d9a5adda31e3ad4ed87dfa9b6d51e9457245809e1e54a6f54

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b84cc4771568f79922f0692ae37dcd9304c8319cd62a47dcd8f89132c4b140fa
MD5 47d21b957f6c69a5d3e80ceeb95f2a5b
BLAKE2b-256 dfb71e6446ff4b5bdd244a2c19224dc07ef870af2d9a779cf7171cc5a13f47cc

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8c7486ce96fb8bd817abea7eeac7c9e40c53ebb42f5b088b4942e2890cc86e0c
MD5 1af2b7867d5a7431c315f7a1315e7e27
BLAKE2b-256 a90f1b01f27c0046dabf8fdd953ffeb91ada22b724c28c637b4747194d670525

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c3331c9c11cb1df162e145e2768f53f8af6ce9fa126a500c0756ad5c6121116f
MD5 5bf78587ad13629a74864bf6ecd7c626
BLAKE2b-256 e86e42be3e22acd8cd566e5e01b55883dfe478b1708db5acd2aeb876932fe7b8

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7454f02b487f82ff0575693e4b339508ad11c96c1380f2a1b9ee050dc8aaa590
MD5 039dd0fcb500f07f7dbe46add0d0ae80
BLAKE2b-256 655c701a81578847c2e6ade137651d2704e15bfc04a417e3094c49c18acc88a4

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0c8a0ec69afddbc7177187e16e0d979120ce08d48bfb2ba3276a59175559d4ff
MD5 766f7cfc799c12c04c792cbfc4adfec8
BLAKE2b-256 80488f2d3a4f021dec99d6b9b965f272ed3d1ea51a70aae88101b45b5cd2c685

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e8cfd2af8e92fc0543a7b9f717ad1a9f579c62df4c77a52b39f9f1ae430b31d4
MD5 30f77dc0aa4b2ac7326e0da9d251ffa8
BLAKE2b-256 073e2fb79c2252f03a7ecf62154a06a5a12854ce4496e4059a14a1ba7d3df263

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2d72ba2e18f5677206473bcb42ddeb0481bebea8fe513e1786f781eacb92a701
MD5 df1e96c9829b597e36e4ab6a11358e89
BLAKE2b-256 11a61d4e33123e346e22e038710ec42e6930e9ffadd4352702903f8909a8f203

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 47293bab24eaac07f84db449692cac0c459ded6fed4d7f496e45a1c62e2ce913
MD5 d96ddab0ae5cbbac44a561c506cecfa9
BLAKE2b-256 a2ae20acb6a5b16f319f2a917febe369934f77bb04767ead755395e02b9b7cb1

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6c3a210254d149a3f97c25e2c6e3d4e6d7197a0b4bafcca1a72d196a5244572e
MD5 caafcbd20827ba747e15df4ccc3b93af
BLAKE2b-256 85cadc15c60a26266cf38eb503c81aa2bd467cb4c5abab991ad5a661fc20a657

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b35f2f757f2a55f164fedfd5fb4b036ad9a0bf199d9db3b10f73194df8f5d22f
MD5 60ef162e7c3565912940e697084c9942
BLAKE2b-256 bc62f480499ec2a6b06fef14236651247dde43622697e30c053e8931233c2f48

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 16c24e5bd010860a4fef8c2e776ffed577cfd9d0afa622af6b450c737a9af842
MD5 a1ff1f3c6669e1b4a14f1cd5fbab0c10
BLAKE2b-256 9b2df9fa2baf2e0be560589131b67c42e0208867538aa65c69aa6217d19807ca

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 de584237c0a8644809ba1078baf964f9af006e8109bc54c72b528ce4d76c1f98
MD5 b4bda8595f40bb3336e2c264a7b273b0
BLAKE2b-256 d1e94d5277e26a2807db6639b883ec439a719b4d1c3191117ca292f584967a10

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1180221c2dd5f93424e2a90a4842cd6ae921fdc44f091ebc877604ee5a9b4217
MD5 65ae21bf350d5c74849d66151f076255
BLAKE2b-256 b0a4f0e8390b48bc851e026e17e235c8d21399f001f09d2b36f2e61d508cad87

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202412211731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 498be837a887b9fb3df260dd6fc35e1f26b836c8e4460b6dc85ece381a3b6e88
MD5 080d1584412db3a16fba57bface3ca16
BLAKE2b-256 d6d516a78b687129a77a6a446f99cf4e0383a9ad7e1259f7d1e317ce70aaaec4

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