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

pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12 Windows x86-64

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

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp312-cp312-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp311-cp311-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp39-cp39-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 13aa167cdbcfa268d66815842c055c8bd3d0434193959b3579fda35197719674
MD5 6049ad317f66d8410df5409e73cd154c
BLAKE2b-256 f4730cedaaa9c15ca9bd0e830fbcea9acbbc8d4d3dc18b2c3929ded8b0b670a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6ca1ada5da6377cb18cca2449b48871c1203f6088b1aa22e76258a94e2ab43bb
MD5 3609f9709f6b3a560e70e65c84d83cbb
BLAKE2b-256 919430c5efe2d7606fd87ab6ac337323d757db80eafe7ad826cbe1ea8100d258

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bef84269721a3d0e687e8f52aea4156f8d6f45e526d4a199d3afda2bd883496a
MD5 191b90b9d4d6b6a2a41e888db64fb804
BLAKE2b-256 bdef4a905e57fabdb7e3523df6c6f21e5f8a10cb0f7b306cfb5b5ed572d23c05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 61fc9c96b12a9b85a3ffadd8beea34204d6f8f938358e377eafcc2f50e4074fb
MD5 003be559adcce8ba539c10e3ef1144d3
BLAKE2b-256 d0268349a6daf49ce5a435d895de028609c856dc3f32a6eec00ec854179b08d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6835c31108dffce5f5cfb822df331957d0d27c2a520379526c1bdcf2c4a4fea4
MD5 5a8c667d1dfa66bb343f0c0e62433b3a
BLAKE2b-256 9b4cb36729b30682221edd404d750dfdbf03292ab69abff1b745ce9aa8c8d889

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 62244abc15bcd992cc422da4e079d5a01d0f0185d294dc4ead3d32fa49ad171b
MD5 7936493536210c19a3ac0562cd09298c
BLAKE2b-256 74091acc9958d62de678052309bf1f8440f7f6f285bd34bbb86f0ca4391df108

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3dac63414f5e1d79e0d71b8ed96053735ed5aaec6b0d2a0bf32c72653ef5c71
MD5 0b03a5daa0fdd478ee2491639f163f94
BLAKE2b-256 1571e9508849d6703a84e66deafaeffb545167ed82738b45e7e8f4dd20491809

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c5c61321e585197d01940687e945e1e2d3c42e550057e51905753b4fcd738413
MD5 fee4ababf698f7b4906b1694328a6dbb
BLAKE2b-256 64396505cd1a5d27e99a04c9637b816fd6f4ffd230083a9fee21845e43e1773e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 22356804fe68b6c74eac37491827d9247482b188a1fed5e36d260aac51fc7ba3
MD5 7ba14574e1e8c8f4ae8fdb4976a0e57d
BLAKE2b-256 3c1aa6765b48377770d2b50f9758e86c853a18e6d9a276f3005aa5b200564ec4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 67ec6a8d869285462b1480c6e964e9a78c0c48f1ffaf1544643a6cb72de16864
MD5 ab1f54ea57a341d00bc680b38440d766
BLAKE2b-256 5fcdeaf7603e43d30a21de1b4ed01b283fe2006c887d85293c2f1b3ef65e3df1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f632456d0246b9eb1ea530e72f65082eb5d48fd20c594f6f4091f9b81599165d
MD5 1251c99b93a4ac5e55b2cc4fa9173ec2
BLAKE2b-256 855e86ede14c621cac7f8cd033d8432de7b2297bbf9b6a981715c7dcc89da567

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 830231e015e0f1865cdc5480955e7280a01a3a836ebadecb7519b286f8e07e50
MD5 69252fb3b9fb4346b6c85fc36ad215aa
BLAKE2b-256 e85fdc69991a0fe1b87e4b00f4f5a90e7b854bb68bb25389eed577755f816e69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5c74bbaac0ecf397b3eded8789189111bc55ca239382a7bd533e5331a9cecd29
MD5 26850be1aca48280d9c8d737fa7bd542
BLAKE2b-256 da1f191c5a5ace5bee07c55b36bb9a6bbc01709793963cc0fe9b712a18bd84b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0092104db4a8fab14eb2d64927bf57f4f5c428225f29823359709063e4bc707a
MD5 29c1ece9272aa94d5fb312e162c19cc2
BLAKE2b-256 342a141768275c47a94fc0c7319f3f88cc5c3e625c3000d61e106104ce06eeaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e5691994ab9e4b7f9f93fa030a469e259e5cefd0827bce05a5b1dea59be546e3
MD5 1615132591a8b1ea4225b4ecfb50aa5a
BLAKE2b-256 8b7c10a4c188912f99b7e8a20bea48d086b9ff714b19793e859d3a739ae0ae6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 66cfbbb669f67555bde8ffdafc1a8a0bd69f4a39691f9c9f2ece7be542fb3382
MD5 351cf44c5b6826d7e14949c10b6c777c
BLAKE2b-256 c3c8e8d3843531df442f300d0744a717bd28713e94e4fae4507fc5e50f1ee8ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 444357748672fd6453ce366105b5cfae1d36f37c1a9ac7c7d12fad616fee6d15
MD5 a370df57193364150d39dc6568673684
BLAKE2b-256 b34bd81d45c9d6a2ff1c922e719dd44c678ef9db0a3fd6559349265acb7cf6d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 61fabb9a9d5cc15ae026acccf7305a5054ebf843eca73e3c856c8de00dad4fa4
MD5 0dac4cb9b707800f05c2910dcfa3d4a8
BLAKE2b-256 26ee249d43d8c6483d7835f251806b3311f18b906beb6dad4ad6850a09d33bd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e2d86e1d77eb84059311a21a14d3d506aa55f877324fda84ea6cdd4b6d3f41b
MD5 ce56ba883345073cb6f083d2a38b9a30
BLAKE2b-256 026306754c49bf411316ebfff6e3e71b32c9fb3e90d792c161cb2810d393e6c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408211723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8f8426aa66fcc488c2b8dc85c87a08f88b236669009a4ee893cd2388618dde8a
MD5 af740347c0ea4e7f1b6db56d266d7c1f
BLAKE2b-256 cad460336ed6f7e385d4a998f487c25b2920a81d02772995f8141d57b1e740c0

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