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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501181731932516-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.dev202501181731932516-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501181731932516-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.dev202501181731932516-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501181731932516-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.dev202501181731932516-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.17.2.dev202501181731932516-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.dev202501181731932516-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c0b34fafb73d64a5212571d2095a1ba78bdd4ee48156eaa0d5af52b97235773a
MD5 b070fdcf792e95d6542d655f5de63f6f
BLAKE2b-256 661fa0a89403940886e7782b6000db17dc8b2b9bf153c5f09d91de4f84da9328

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f0257ec3eb5a6f776223ec7297bbe27ddf7eceb838afa7fab6fbfff0f7dffed
MD5 147be0dd51bb1aea133afd5831080a55
BLAKE2b-256 ca62826c72e7a02236b6772f2d73b38dbb8047a84c431f9704bd0b8a02e7ca72

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f9d413b24440e52f6c9d8e41cffc613ba7b3388abd8593e571da60220163d87f
MD5 44187e32bbfd6402ac635904b32de187
BLAKE2b-256 04c021518538c4e27354508c16acc05741b1a504d83c836b5c31a2066b8a2853

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b97de424cc2a5bee9136995b2f31fc92fa0dafc6945e172ba982d7c16c499eb8
MD5 88ac62752bb1ef0b05eb1b8bf41ee56c
BLAKE2b-256 ba07d476f4a684b2162583662eafc102d42137e95d8ea5231d599a798e4bc42c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c611aa79245aa4ab0585f366fc4305ab5f79d0461d6ca9cb5656461c6191ab71
MD5 f250a73badd7aad887f7c18c3510154a
BLAKE2b-256 30cf2ad19dd629beaa6702f7a0fb33dac2a11af7a4f4586c6955a6fa8111bedd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 01862dff418f41f7e4cae5f43e62ef3473c93bcbf1f5f315f3a1b70747f4e673
MD5 da913246ed84bb86c73692bca3bbcec4
BLAKE2b-256 058bb8dd70580d2bae09232dc2c70c925e88341b6f855db606a8edfb83cce114

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6a41761b659ad75088aaf333dce69e26bfe85dd28479e792c4746de81319645f
MD5 03f32938c7e7ae4263b36ddb92c1f69c
BLAKE2b-256 f29dd11c41b154ce592576dde975b283c5ff43f4374c62f49d7ba37dbaa928cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6cd5b624b2fd9995a0998e9b4db082947d8bd2e72d88cbcc53d975aa5ba5ddc2
MD5 bb88cfd15ef51ead475cf4bb07462cef
BLAKE2b-256 2e33b2feba9441fbdd46fe0e67eb83ddd3540a82439db43c39fde332949364d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d92070f7d3e1df411e0e05a4326a6ef8a5da987b6b80d18d8d950aced0c6858f
MD5 7b33bf99b76f158fdea020623fd808f2
BLAKE2b-256 3b964795f8858f3ff546118347d4b309be1ebe7f3d425cabc8ee13ad3fc9e987

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e79f1ad096dcda5ba2e02cc26c23c1cb2169df8f6fdbf77dc0b6088309149c0d
MD5 323a96a0388fff68fb4bb0ab56b02fea
BLAKE2b-256 a4bf91113a8483dc0fa727c34fcc962b43a19bede647e5c43646d4886dfc2d2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 33d87d347152693b13ac7f1163fe7aaf56fff408edcb51e04e75b35a1c9e0fc1
MD5 cdfad421428936684b5df91bf8bfdbea
BLAKE2b-256 8ab2a90f58e35a0a9dbf9dc3cc100b1cdc327158e014cb3fd8285ba049757b84

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 36480f936ea0188b3b192b77d7bfd4e3873f3ec4ef2757e30a9a87ed45631786
MD5 d675a9d66fd1f08c312efa3c832e61c7
BLAKE2b-256 cc3324be613dccf42a764eb11b489fe8ca52ebd2c5b4398535d6f6beaddc5a26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 009f994e03cdf6df3590e247b59bafdf977653be7188d5808805668c587683ba
MD5 749087959024121c90ca4e5a2aab6f4d
BLAKE2b-256 0ea09c03aa7e630589a4d1664793f6b19314517e7c358a527c557a6c989069ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f89346af77ae56711b994d3053f06997364633920772d65ae0a775f57913229c
MD5 4e7ececcfbe4afccc27360523a399d9c
BLAKE2b-256 a5bf85f2a5814a0eab6c729e2648c1820d6f11528fc84684c48962d828a43460

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 07bdcdf232110bf0444d8ab89156516a85a938cdefc8d716c6a3aff9867b20c8
MD5 1aa86310a07679af0d600b5f74c9642a
BLAKE2b-256 1d5637aebe71d728f27ba577203b2746accbd5e6b93ff3b8d3386b46835f21a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d5638e23f608f1f6a734c61ae998f5ced0a25e945db99b8d4cf3e8ad608f64a0
MD5 5835e90b4b2fd7df0b851484e626678d
BLAKE2b-256 6d2f4e2165ccf2d6b09185ce355426ade02bd9d438af01d23c403b662960fcc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e5b25724d2963e3dfa6632999357e6a18ee8bd181baeeadfda1ebee50c1275b
MD5 d391e520bec81cdcaf0c2a90d216ce4d
BLAKE2b-256 0cc75915bcae3ee2938590e3f797dd5f76debe3b9fb92aaf95295fbec83ce17e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 663c42287d2959bbcebd9f0a99345ef8851d6d9010b723d5e2c9dcf31b632ef9
MD5 38d80b5ca0b79632ab20c959d626582e
BLAKE2b-256 2bc978fd22be2430d9963d576f7006dac606534d5debf515a4b56221343235a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43f591a5ab074204b562274407b22c9ef9dc505ac9c975d11f155d8a741c0a4f
MD5 310a5ca9e272500505cad192c6e4fc12
BLAKE2b-256 d7236dcbe2410c85c3a00ca7229256ffd56de5fae44e6149e865025662bbc45c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.2.dev202501181731932516-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c23cadefeb747cfb0acbbeb9c7af9b4582c7280c99e1310219da75278704a5e9
MD5 bb0d541af162146801f6355d0769a03e
BLAKE2b-256 b091ec4b2590be9cf34e03a7cfe763aebe7d15b8eaeb452d2ea4d1baf506609d

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