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

Uploaded CPython 3.12 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

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

Uploaded CPython 3.11 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 Windows x86-64

pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 770790d24c477ecab8be2cf458313995ce001cb05d2f9c7f8c43656b19705593
MD5 da486155dae3a52933ceca98bc1c97b0
BLAKE2b-256 cb5bd8c11c51c3e4100c5d0bbea240ee5bee452561447e24c7c441995d237666

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8475864a9b4df4dafe4fd2c38b28b7191fd43f2482fd1e7016162eb33106e7b7
MD5 5a7bee4921d11064977c1dcdcb4e3832
BLAKE2b-256 b2b52083657837aa3fc040239dd342924ffdc9f9c4f9321e145d26dee8aae036

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 740168ca744bfb987fde7dc10988311e5d703392ad462c435a6004d19a5820a5
MD5 9b86d54f843733ecb5dc444c0a8d382f
BLAKE2b-256 267c654219be3e8dc94ff3f5cb10478b7b717237e8ae17956fbeacf8aba3c9d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20709379a6ef26e01e653e8a7a07f0fe439b9835c23c78403629b1c43d57d2ff
MD5 285db1d212338a15401699af5008ee80
BLAKE2b-256 f49d14589bc4ea72a90f7e06d813528b94e0db7d73e9a4bb68cebc816198bde8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 961d7f06948bb88041edfb58c383815c0f7f108d4ed2b154d8fbc83dced72741
MD5 df59f75d0dac222495dcd32b68b1343a
BLAKE2b-256 41a5a06e8d56c10b396ee3afd770b191de8eef3ca66a2d41e2aa3e8e9bfd8260

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bf761d541235e007d4b91e94efcbfb2de07fcccff26558bfe69f33e36728842c
MD5 78ea01d3918781ae3fa5d5892753e972
BLAKE2b-256 3c7e9c8b3b86012a8ee8081c82cb2c90d1c1ec5d77ad5702bc3f26058baa1d9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a0405b127196723fb2565621a734b59113d5aaa20ceacf7ee0a657140645b85
MD5 0f28e3e31a4029d223ca5bcb6e68ed96
BLAKE2b-256 cfe10c82627b18fcdbc5eeeef19be571df29f9051d54034ed509e0d76dea82d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 829a93a6ae6a7bfd6f9aaee679aa908ca036aa2219c42bc2f54cb4070950a127
MD5 f05c6a55d945cfbe05079404a58a60a1
BLAKE2b-256 cc126fb01cfbadc93311a4342c7eb89a57c613a618e04ba81d044cefff4cf3e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eec6a06d8848949408afa2484b8aa7d83582ccd3b2b011c543c1370083344a3e
MD5 e2dc21459b27bb8ca3487258ebdf0dd5
BLAKE2b-256 55441663e9e7c5016faf8e45cf65a6a8cd070849bf360f29afde619f811dd472

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b2f172712341c4127b4b67e08b22778072fb15abf893af7b2fff0ed215aa8fcb
MD5 9ac6d04911bb4074f495fdcfd486c0d7
BLAKE2b-256 eed602ce60fb5fa2a609a84eb137bfc1baa66c782f3bde4102b39049b389f7f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0f08e728b3f0a3716453cd9b8d5a753bea426c17590f38676d14a16375c4462f
MD5 14d327464fa529c9addce4d216308d6c
BLAKE2b-256 1154f2436d61ac643c83a314d82b40fc6ed2552b4327b02a8b8635390693c0b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6836c2ddf1379219a17244cf52eb41d01176d3779cf2ebfdee7f45892623b6f9
MD5 798b5be0722ebd92f535c38a6e273cf8
BLAKE2b-256 afa9e2360c616cbc672c770a8df4273032054a9a9f3fa8d53b1fef431fe6b0a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 af9cbec80f20ef171f825efbce2b2dee1e29ee5540ecec5d115e5d7a771ce73b
MD5 c2574ef143a9f5e9dcf5930a8b124b75
BLAKE2b-256 b7a6a7eafc77daf248e65d41b916a76eae5af389049e37467173bdf9bbd6e9a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d2a5d5eac75ddba2c3edb2d1bafc9b25dd24b2b50a160d08b2827a850ccb873d
MD5 17c76979fa68f4e9289f21eb67d80a22
BLAKE2b-256 1fffd2101b8388c9a5ba7acd37ee12c9478137d351fe37df4fea1d621c2b3e19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 694b4f2399a9bb03b54480893042329ef4df22a3b657ef540ae2b59da9fa2c3f
MD5 90aba3b5838d6286dc515f9eda79153c
BLAKE2b-256 dbaf44d0cc8f5c38f501729ae2faab4797047f28de2ffaea0790efb2a6886a49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9fa455241c2b67ba13ccf3788db51f5dfca07d8dbb0ccbc85ded2e1c617219a8
MD5 77ce2c40f9c5f02f7ecc0f6e1b32f6c6
BLAKE2b-256 a6933906ad8067d2dae51e39df7b6f819f3d4d7c6f6c3d83bc6029d5748bfdea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 062722b5d56bc759814477e9ee5810989d3f857897ce3c8a96d2b7a52bb4f6ae
MD5 cecb6ccb2ff1ed4f7245cf7846902288
BLAKE2b-256 b11995041a90b8aa02d53fd8e8100ebd69268286550090e0884b788a9906786c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 09a2d2ce1070d3ec8294d5bda7650fefe67111ee8dd33597980b8764cc473eab
MD5 3077f6ace4ae586ed0c875ee7c6ca788
BLAKE2b-256 3ecd63c9b743a4d8df7b564b545dfee5de2602a069ef745ef28afd79048da2bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e99638726e9e261e5ec0e09115535b2b1a25e853cc71a81f5c566e71111ff378
MD5 e27f6fae2ae2aa13eeb23d21a536177c
BLAKE2b-256 a33928e83dc88cc45fc50048a824502259ba45eef288c7ff290851884750fb07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.0.9.dev202407181721169663-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 81b12734009a575943917d9de9b218f2898f8c7bf7109fb65f8eeabf8e0ef504
MD5 4a6ea58c5c3a6e3b8e6a08889162471a
BLAKE2b-256 ca1e02ee32532cdd462d5127e6f51de647d262fbd69858ea80aa340142f9664d

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