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

Uploaded CPython 3.13 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-macosx_10_13_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411171730930665-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.17.1.dev202411171730930665-cp311-cp311-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411171730930665-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.17.1.dev202411171730930665-cp310-cp310-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-macosx_10_9_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cb28dbf79c1952415a0aca84cacf18d5abd36006b55fd97cd061227600a0fb88
MD5 aef012b89e83c83b841e4380e01b3acd
BLAKE2b-256 e3f07f9f16cfcae43983c87a36fbfc9a84d225f1261814a71c584cd25b511ae6

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b555a54e40c6e13cd5d8ab8732fb7f8c7f549cf925e15f8e4e6c3c136e7a559f
MD5 4458fa968374fe4f1f4ea36ff233b47d
BLAKE2b-256 5bc538029423e9d252155d4ec1c7d13be1d5e363eaa2992b2d233e8f436c7f1d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 23441a4961474c04c33ac99c0fd66891dc95e50bfb00f7e5f32b69c268599999
MD5 6979c43228c95cced8f81f11a369a70a
BLAKE2b-256 5655acbb1afdca6f5ee1b654b673b3e1106f1992fa95dd653bef090b046f6322

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab482c2e77e993bec678ebe934c41e2edfebff134f81eff4059042e86de7cdcb
MD5 e45c2fb65b32276b78db1b5ae875e9e3
BLAKE2b-256 b1dd53787c22cc0758402d80075d1da37b278181c7ca7dab0fbf3634428efe05

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0d774c1b57f7e34c239234a50d58f980ff9fccf4810b4fd7ac8f63ac588c352b
MD5 a72d55736374f0553456c20cdbbb42b3
BLAKE2b-256 ab82f19878a2dd7a60d158bb0a6b006029e2dc1b167b852c794ad3c738d8ca88

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ef0ca2b947b0951f224cd1eaf0674c83186a2472a81b3778e7f9a74ef9e92668
MD5 45b0487334f880b4dec4bf7745fc12a7
BLAKE2b-256 7147b97bebe1ec9e9330316852aa769d2fb47ec727d7fd45967d032982e93734

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9910db310885a9384bb58fdce0cd07202f2f711e1c1c7c2046c8cf30f1b8e6ce
MD5 ed3ef1ee685a7c43c6a50a995b4cdfce
BLAKE2b-256 644beb8e3e78439415362f428bcdbc3b7490ebeaa834e88d9ed3447533b3f936

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5755095892ebe91fba2a67f69bdf9cfe66ee4825bc11b79b54d024c17ddf39a4
MD5 1f82309c081de1ca81a73a942466b1b9
BLAKE2b-256 a22ed964b7abe92e619829431e8237ae50ad4dc624167787a094b3c641d0813c

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 218f6f7576b20f7b576a23a4699ca1d4c275ffd1f2dfc533e42703e82ff4482e
MD5 6c543d1fc7878d482b6e0ec5bff0a3d6
BLAKE2b-256 d914a1dd15e994e3b83de9e85e8f2f304715c611e1ce340ad885bd3d5af7f98d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ac67061e0cb4c8566d9fa01b48fd1bc66d8f187b8d75104e07d44be9f67dbec8
MD5 6dbf201cde404b7969e8d086a3eca36b
BLAKE2b-256 f191e9bbe9357b8ba09a484a17b1dd61a7ee789e6c176259d6ece903822f0a64

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 91900d34aaa01e19cd510874480915162df059d303097d303a64c9df4b978129
MD5 100a0bf6bb577bb149920dd684fec904
BLAKE2b-256 c3d8aeda96dca6cb55c421520a121b36bf4865413ec8122e3b9be04dcda9c684

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b4a8f690030b994fe2fe24d12291c97c69ff53ba8fabda3a816ed0b671f5fdaf
MD5 bed28e7dd0926c8d99f68ab70b0a58e7
BLAKE2b-256 64ac5ffca9623b2c2695be1cc5489037d12f02e9ce86382aa90dab2424f2b170

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c388cbb051823cd464bb53d70a8e2cb3e9197ce1cdb83ed870b0c188eb3b0f80
MD5 509edaabf5887ecfaa629383b30180f7
BLAKE2b-256 744cea75e108329b0b202612c25678ebe0b39678867e1fc1ed88411271ba6298

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2f42226adbf373e78d697d1a85ab812bab6b75cd0ff967a7c53246a8c961ebd1
MD5 d8cd9481f1eba0bc01be7a25002c6175
BLAKE2b-256 014c128454bac66c9307da5848099fc9e84d5d92fdee978baf30dbe2e320743d

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3bd44bd94f75862131d48f05914a6758beb55ea81394b54a1e4a1484834af41b
MD5 239292c2032df2d07f4e162a7e0ccdb7
BLAKE2b-256 e0bf0847d6c25e2e68ac06e3ff935abbe1c3b14af61c9a192f07942f23d0aaeb

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0672816855332dae242740b1b13ecabe7fed3001b63530fa165b9916e81eb070
MD5 466ffbd01defa2ef1b7d6de0d7422125
BLAKE2b-256 59f06553af132595f8c4922db139f57311a10c1af6dd468dcd3ce606e346e374

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 090eb2e3747fc1d57dfa8ffa569198c1a664447f414697d758e1fdcbb19b383e
MD5 a674ac61ca7c6180dea3e1f674d450f3
BLAKE2b-256 4b68046abf6f594da32f7a5f2b8968d421de74d359f7c75db7bb1f0055286d8a

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5dc90e53689fef16c3b503d1867b87db8b778b90250e5e34ebd9926f42f09dfe
MD5 6e8f830930f09dc6ca86b0658e5c3e0e
BLAKE2b-256 f7086b09d0b3b36965a10c97a3e0ec87599240e8721828241cbfe6e61fbfef98

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4d2e08460c40d37133f1d78dbd92a0a0ee3d1f9bced459fe5ac6f5d32131401c
MD5 12d09049368fea5518daa6eeff403c0e
BLAKE2b-256 fa887610d1a2c7073065969b17500e42b63d60a243991a0aba5da3e5f85cde02

See more details on using hashes here.

File details

Details for the file pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.17.1.dev202411171730930665-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 66805a24a030f061e59a3d54dca0e985bbee00bb8045786019190e6d1db65916
MD5 b140dae004ca47d3e32da3bed26b8f8e
BLAKE2b-256 4baa23cd0adfa37a5b6c696e7c9542a1a25db4f9b3665886f46bb6e264bedc80

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