AndreasHafver/ BayesianNetwork

Bayesian Networks for probabilistic analysis

Contributed by: Andreas Hafver

This is a simple implementation of Bayesian Networks (BNs) in the Wolfram Language. BNs are probabilistic graphical models for compactly representing multivariate probability distributions with conditional relationships among the variables. This implementation works with categorical (finite discrete) variables.

Installation Instructions

To install this paclet in your Wolfram Language environment, evaluate this code:
PacletInstall["AndreasHafver/BayesianNetwork"]


To load the code after installation, evaluate this code:
Needs["AndreasHafver`BayesianNetwork`"]

Details

The Wolfram Language has extenive support for probabilistic computations, however there is no inbuilt support for graphical models.
This paclet provides a BayesianNetwork function that creates a BayesianNetworkObject. The BayesianNetworkObject can then be used with the function Probability to make inferences. The model can also be visualised using Graph.
This implementation allows the user to construct multivariate probability distribution bu defining each variable as an CategoricalDistribution or EmpiricalDistribution that may conditionally depend on each other.
An advantage of implementing BNs in Wolfram Language is that one can compute with symbolic probabilities. This means that one can do inference even when probabilities are unknown/difficult to specify and use the symbolic forms of the answer to gain insights about a system.

Paclet Guide

Examples

Publisher

Andreas Hafver

Version History

  • 1.1.0 – 06 August 2025
  • 1.0.0 – 05 August 2025

License Information

MIT License

Paclet Source