← all repositories
eBay/bayesian-belief-networks

Bayesian networks as plain Python functions

eBay's library lets you define probabilistic graphical models with normal code instead of domain-specific syntax.

1.1k stars Python ML Frameworks
bayesian-belief-networks
Velocity · 7d
+0.2
★ / day
Trend
steady
star history

What it does

This library builds Bayesian Belief Networks using pure Python functions rather than configuration files or special syntax. You write ordinary functions with discrete or Gaussian continuous variables, and the framework handles inference behind the scenes. It supports exact inference where computationally tractable, plus MCMC sampling for tougher cases.

The interesting bit

The “Pythonic” angle is the real differentiator. Most probabilistic programming tools force you into their DSL; this one treats your functions as first-class model definitions. It also handles the gnarly graph-theory plumbing automatically—converting to junction trees and factor graphs without user intervention, even for cyclic structures.

Key highlights

  • Four inference engines: junction tree message passing, sum-product, MCMC sampling, and exact propagation for Gaussian networks
  • Automated junction tree and factor graph conversion
  • Graph structure inference from mass functions
  • GraphViz export for visualization
  • Minimal non-standard library dependencies
  • Tutorial and examples included in the repo

Caveats

  • README notes “some limitations” for mixed discrete/continuous variables, but doesn’t specify what they are
  • “Seemless” [sic] appears in the docs—small signal of maintenance attention
  • Installation is manual setup.py rather than modern pip install

Verdict

Worth a look if you want Bayesian inference without learning another syntax, or need exact inference on cyclic graphs. Skip if you need mature probabilistic programming (PyMC, Stan) or clear documentation of edge-case limitations.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.