tbnpy documentation

TBNpy is a Python toolkit for tensor-based Bayesian network (TBN). TBN tensorises the quantification and inferences of Bayesian networks (BNs) and thereby addresses BNs’ scalability issues when applied to large-scale systems (i.e. high-dimensional system events).

This is the documentation of tbnpy 0.3.1.

What’s new

In 0.3.1:

  • Joint fields in specs. A custom spec node may own several variables (childs), so a field drawn jointly over many sites is one node, as it is one probability object.

  • Reproducible seeds. A seeded run gives the same samples in every process; before, the sampling order depended on Python’s per-process string hashing.

In 0.3.0:

  • Readable models. A variable or probability object prints as one line, such as C(P(C | A, B): normal(loc=A + B, scale=0.6)), and print shows each variable’s domain. Custom classes get this by inheriting the optional base class tbnpy.Probability.

  • A model check. tbnpy.check_model samples a few rows through a whole model and reports every object that breaks tbnpy’s protocol.

  • Models as data, documented. Specs (tbnpy.spec, tbnpy.compile) and diagnostics (tbnpy.diagnostics) now have API pages, and the ABCDE example comes as a spec too.

See Changelog for the full list.

Background

Bayesian network is a probabilistic graphical model that can map the causality between variables, for example:

_images/bn_illust.png

An illustration of a Bayesian network.

For further reading:

  • For a brief introduction of Bayesian network in the context of system reliability, refer to this blog article.

  • A formal publication is under preparation.