Overview

An FXTensor is a morphism between finite sets. The array axes are split into a domain (inputs) and a codomain (outputs). That pair of dimension lists is the profile. Each factor may carry a list of string labels; unlabeled factors store only their lengths. An axis may also carry a name, separate from those labels. Names are optional.

In a Markov category the objects are the finite sets and the morphisms are Markov kernels. On finite sets a kernel is a nonnegative array whose codomain slice sums to 1 for every domain point. A state is a kernel out of the one-point set, written here as an empty domain: a distribution, or a joint distribution when the codomain has several factors.

Piece

In FXTensor

Object

One profile factor, for example ['Sunny', 'Rainy'] or the length 2

Morphism

An FXTensor whose data has shape domain + codomain

State I → X

Empty domain, profile [[], ...]

Sequential composition

composition()

Monoidal product

tensor_product()

Copy and discard

copy_tensor() and exclamation()

String diagrams in this documentation are read top to bottom (inputs at the top, outputs at the bottom). The conditional-independence figure is read bottom to top. A box is a morphism, a triangle is a state, a dot that branches downward is copy, and a wire that ends in a dot is discard. The figures follow the drawing conventions of Fritz, arXiv:1908.07021, and are drawn separately. TikZ sources live in docs/diagrams/. The SVGs used by these pages are the local copies in docs/_static/figures/. Contributing figures is the note for adding a figure when an issue is resolved.

The test module tests/test_axioms.py checks the finite-tensor forms of the monoidal and comonoid equations (associativity, interchange, copy laws, and naturality of discard) on concrete arrays.

References