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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408231723794729-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.1.9.dev202408231723794729-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408231723794729-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.1.9.dev202408231723794729-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408231723794729-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.1.9.dev202408231723794729-cp39-cp39-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9macOS 11.0+ ARM64

pyAgrum_nightly-1.15.1.9.dev202408231723794729-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.1.9.dev202408231723794729-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e4cb73f6b0425fcf502c40065ebd0f298f05c07dfbb1dca7835f75da0f0af1e7
MD5 e5261652902bc83346181d81039d750b
BLAKE2b-256 d26fc2a6f3a1c2a6cf5eb85567727f2961120bac0ef4301355f1768476772695

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f90190207a32b59fb2c2ff3459f5aa79677b975e51a46c267cb7c10e4148f88
MD5 6d28dd95cbb0c415e4bc1a4fb48a0626
BLAKE2b-256 7efd9c5d09ef5a6321284913aca1d4029396436bff6c84a487ce0b6ab3569a0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp312-cp312-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4cec56c1aafc0f72e0f6d86a51d57ae3f257f5c9761a1b9fbde23146d31caf02
MD5 c0dbd69910a4be96d5dbc68839eecce3
BLAKE2b-256 6d5b7cbcfa2d75cac73023502f17566c9e616d074435bf4aa18f34c8dc6f34ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c0cdc4cb32107e7f369b93bf4a6f61d15ea05bb06a932c06ec2eec4f9bf35a2
MD5 f0615e346bee016fb20e9928bdda03d3
BLAKE2b-256 3840fa906dc8c9b6bc15e30a092ce15591ed6aefe24ff8fd6406f00c4305287e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5d5467566e7e9738d1d7477aec2cad4999d3b8d816f211367c4cf31c6275cc69
MD5 de7040628afbc0f6aef93ffae609eb96
BLAKE2b-256 96f2651a73b18faecdaaa8f5c5ef8ac3eda33192d5f682ef0a93550f4412cb2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a2b3a6c5a91317685b97744b39db6b41243b8422e7f5191b2b4797f5653e3234
MD5 86555851d01eb1a55052a3d64d9b3a06
BLAKE2b-256 47a4ac04c90b2e4c8e550b296f446b2a6c30d84af0661e254263a642d42fc45b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 67bf133f2ec6bf3c873100c0b0750ba438247651b36e0a11623dd857f7264221
MD5 af6395db74cb0d123aeca0dbe8b8313b
BLAKE2b-256 45837bb1378b0f7587c44a84f4ba8e3ee19646cbd31ae64d3877f79d80eb1343

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp311-cp311-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8f7794146cd6556eac3fdc4efbe0cd65ca2f4a8a9e793531802d5784ed4bd9eb
MD5 4f3ad0aad4a52f0403aa3121dd0ee729
BLAKE2b-256 ca4f7fbaa9c1501ca9a0d8b25e6e705e3f35605cf9bcd7280f7026ecdbdb42c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f670bf90a509f5c2049db45c2ea9cf0142beff1e571739a7b3940f074d9ce849
MD5 2b383a9e28fcef74cab9a0f0a8544b4e
BLAKE2b-256 4907366292331f643e26cf1cc0600d7d633f0e02b4ad17f8437ecd87d4e9e276

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 79e306f0e32d4ae3dab7dadbc59a006f888fe526e9bca8b7b5f866cff288375a
MD5 924d1ed04d976c2a089e05d2347d3f22
BLAKE2b-256 07e6e106b3e910edd62c6aa7806a4f4b48d1fcc70e13ef15440c81f81afd7a28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b6f708c15711e3b71775a640eab0d07f1e7e74f503753dfa70aafe5f65f7e5c8
MD5 cdba2b6053713688a6b6add71d393e4f
BLAKE2b-256 5f6387f441a1497c6b5b6a5296d988576a68fbe32bd6e3fcc26f38a6fdd30841

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f5625f1757c6e196a480f4d58457a91ab722ed69057ce20a020cd0ce2f61253
MD5 80610aa28b1923eb1bfadb11128ccc0a
BLAKE2b-256 23d4234aa0a1bef1e660d5fbe87c44bb23ac8fb85b224737b21790f7df8407ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp310-cp310-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a57eadc5de78b03c50742ddb2262a416e25ae64372a776271178a57c217ae5aa
MD5 45c4c20fc2f48c797b68ac8471a2a920
BLAKE2b-256 b3680103ad93c7325a2af07dccb2a2c4881f249cd83aee67adc50646e7045543

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e1a0fdf58151c40576e56edee599eb803c202c5f983e1f8155890b54d13eb05
MD5 ebee80191aa2d89b37d1c89142d13cde
BLAKE2b-256 cf4b8aac4e0604f825fb0b1e99217ec0aa30843e87112619a324f1697caddf5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e7914e93b917fc94c79c30a07d84376540335ef5cfdd7599fbcb87981cbc6f76
MD5 49f0c9cb6a1b1450857495fa4ade49a2
BLAKE2b-256 9c16b64fcb56ce8ee5dc07ceb7c9c4277e2506f7d2ff569a228759e709af417b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ba6ee6baef08835394f6c489d35e95e4d4d2cb245d982429a10f89c7307110e2
MD5 be1ca730fb710492465efd83fad9ab28
BLAKE2b-256 47617a1fd948cdf1d4ca01e13e6e2a525687a259ce9cb7a1b38542ba38e45077

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 708145701fc1d28c87d978f1921ca7fb4ed65316ed193da881c62ec5ecfd9717
MD5 79b94b8a0e1bee3cda00cabf81aea4e5
BLAKE2b-256 fb8d7c4f18de00c37588d064a6a12059e141e3ebecefdd5b12985ceab67418f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp39-cp39-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e38ad6e16925e9dca4fe0944b8377e818ca9059ddc5e37b8d664ef53d52a0595
MD5 98441932dc91725a8c15dceae822bbf5
BLAKE2b-256 618f5b486f8142dcd87765099f710a16ff8ac4b31b2a88588fafe06f733985f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 034aad846d09ed533e87062dd486d2d3d6e6ec43a12418f0b31a5aadc1aa9cd4
MD5 c7e1006f2b3c1ed13bfcb231be34c141
BLAKE2b-256 62c6432f7fa694cc666939b4cb54fcc02c969906c2d337a26cb4624750bf51ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyAgrum_nightly-1.15.1.9.dev202408231723794729-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e3b96aebd6dd54cd3ed36ebf59dc8c2f55dde09509310b4e512e2c862024b985
MD5 041b6ebfc6c0a232e67e1b27136509ff
BLAKE2b-256 85e87a29bf60d82dd76a91042cff8acacd67ae125c21f63b4e92f1427b315104

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