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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e066dded52329710bf9e347d0b3a674fca0928c6efc4d8326595a885792a5b12
MD5 588778d91fe304defd692a525123700a
BLAKE2b-256 229aa3aff7418bdfee9aa6e3f91357118db308c77813db6645ff49f380360732

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb52c26cb5f99e2408530011e206447ebb2e41a3216ac99e07066f40d70c04b9
MD5 ed21816c3582a8309963e731bdabdd2d
BLAKE2b-256 43ee416560c096eaf867d7485b01d005fd9fa5d222aa3c3671f64280a04a11ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 12e828418a91160cf4bc257520609cfc1871cea9696718378b1f965756295ce1
MD5 6d50ddcbd7721a4ac17aab57ba5c9bb8
BLAKE2b-256 2f0adb4fdf7f4c89b0d97c67f79f3c74a7b2e9dab390055ec5b91981b1293ef5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d498bd9b3408e48beffadc36336bbfe1f593e21f3fbe6662ebc0f0407f170e1e
MD5 22d39b0ae841128e3994b2cea0283ebc
BLAKE2b-256 da5a2220ff16865b58bd46bd7dd27f08be8a8c2f85f7c5e2f0623c2da7a0b6a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4ce5b8f67349e471eef874932a34349a17668f3d76891944d1a922beefd15e8a
MD5 9d7fc490e4400898bcf1b23cc6643838
BLAKE2b-256 5c58f92672f88d4abfe0335c79c81d71e7be70eb938e72ba4f39e5bef00baec7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5d529fa46978ad615bc826b1f448fc1227f740a7d968bbe364757019d470b4f9
MD5 76677884d54059ef55b020fdbeb565bb
BLAKE2b-256 fca8f3c9838e45a564d25d273f0250763726dce68373f84803f7f61d7fc8c277

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c94d464690b0b45719caa9733c7279d6fda38cf87179076c411f1fb0eee8c634
MD5 af07b54ffb6841c61077102992d871b7
BLAKE2b-256 0588a68d41ed5f82a9719ff34fe2719f59ec500dbec7fd9ce0bfd6a9d8e3c153

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f1c66ddc5e080606dc54aec0fd999b8f1b64d76c6ab790863ca9808491a51ea4
MD5 1812325a0e9ca35ad41a3d08c181f595
BLAKE2b-256 27a63b6e99fc659ef6a081f5e6c7c6d6295b4592cb8c5657b50ccd17cf9e92de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cb2b27c086d219c4bd54103eb98aaeecb19f20359d2ac3bce2783c20e72276d
MD5 35394e51c7486eebe695d703ad52c8af
BLAKE2b-256 bc7c191e423a512df5410a27364d5a2e96eebcb4cc21aafd68dccc4c4da17bcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c44f507ca18a32ad44ab682bb87a0b0b38474626ea415fcd5c057d57971195ac
MD5 9f60c43bbd1b273f5b80313e27d8f718
BLAKE2b-256 5670fefb35b40b809ca714f1983a7f216ce5f8cc38ffab185c0d25e65a5e8139

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 88c46a247c8771c91a6c78e1c74cbbd5d00b0312750c5d91f7b9c30b7f1c6f72
MD5 fd3833c1b44d75a026cc7e9d30319cee
BLAKE2b-256 27aecb9f1dbd7c830f886064de565909ff5d6d47f19797f5eecb20fdee3f4c7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ec8c6ada3e7d12f8a1a7559c0218c76e7ca2ce9fb174c602f3d29369eb7ad13e
MD5 febe20436fcbaa383ddc8aaf011ee8c1
BLAKE2b-256 99a23344e0d5e63e52030674ab12febd3dd76d7e8c1887629c61c9e00cd14de0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e9d95d1ce74dc6d11accc01f346702088d28000f240d4e431fd0e3d3579d05fe
MD5 e362ee00029ae5831fd623b5f6ead8e7
BLAKE2b-256 23dd6e59c4b3aa3f6f3d73e9a5c4872cc0b1514d6a849aa47a49d88d5cdaa8df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b074d1d4415e0aa5b6277570569e82f067a8c9827937cdcd094f517c71a4de0
MD5 c7309f982a08e9eea3d1317b713694c6
BLAKE2b-256 04648f7f3a8a7c56a1d779298f433858199c568f5ac66008f5b96512694149fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0b269c84a169ec2005c1bcbf7f6286ab93269958e83e4e7058203e429744ec5b
MD5 4faafa2172fde9d68437808e1b1221c2
BLAKE2b-256 101fcebe45b1b471e8f1af7accd5b4f2b3c50243025d41904286412db075a8ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f983c4481033dc1d57ce4adb669b0fe66c7ece4a191f2b9f3662ed73600994f8
MD5 3b6f22f0e46fe6fcc166af0150255308
BLAKE2b-256 83c726b63f3b52f3dc38bc8b5254ee842e9a4130e37baad7fcac1b592b0b6a26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3092b558739cbcdfe3f16adb52aa100ef1bd0d290f9d854ffdf9adfc3e7703d
MD5 1981eb6236c7d5b1514dcf4273ba13aa
BLAKE2b-256 0d7bb03838de9e670fdd70c1cbff41dce5410c55fd14049ce3131e978cfc6720

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 05e8aed01ac738e18b90df5ae0b0dbf472e8af50c312a3268d755dd7c21133eb
MD5 ad6c90d8a67e1665d3018ad80ceb54a2
BLAKE2b-256 3f3a136e8e76235d41f7beb18206687b6ab0515801b4fe11e0cde2d65917f84a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab00695047ee46e36d2e642eeac5a671b7d993f2d70f3000d4b89a3195393207
MD5 3484de6f2e5b8d2fe82bc1631bddfc16
BLAKE2b-256 1c87268d0a88d7037496f44e1a91c42b8b17e41afd8fcafef7bdcaf6b6e9e145

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407301721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4cdbad9c650e63983f1258e1d31f418bf7bb8c7d1e08c4a2956450dff266ecc2
MD5 666b3617bed66350ffcd19ba0b224339
BLAKE2b-256 f0e82caadb2c4feb29bc791a60863251a143ae6d8fdce5911c50a857ba7470e9

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