← Back to project summary

Bayesian Network Inference Engine

A closer look at what it is, what is in it, and what I built.

What it does

  • Loads a discrete Bayesian network from a plain text format, such as the classic burglary, earthquake, and alarm network.
  • Computes joint, marginal, and conditional probabilities, and full conditional distributions over query variables.
  • Runs exact inference by enumeration in topological order.
  • Runs approximate inference three ways: rejection sampling, likelihood weighting, and Gibbs sampling.

Notable pieces

  • Markov blanket computation from the graph structure, which is what makes the Gibbs sampler correct.
  • A shared sample generator that handles both prior sampling and likelihood weighting, returning a weight alongside each sample.
  • Plotly box plots of percent error by sample count and method, plus timing bars, generated from repeated trials.
  • A unittest suite covering the inference paths.