A dataset is not a function, because it is partial and multivalued, so it lives in a Kleisli category, and choosing the monad chooses what “impure” means.

A dataset is often read as a function . It is neither total, since some inputs carry no label, nor single-valued, since some inputs recur with different labels. It is instead a Kleisli morphism into the powerset monad,

where multivaluedness becomes a subset of labels and partiality becomes the empty set . Probabilistic data replaces by the Giry monad, , so a label is a distribution and composition is Kleisli composition of channels.

Remark on monads as purification along two axes

Reading a partial, multivalued relation as a pure Kleisli arrow moves the impurity into the monad, along two independent axes. The totality axis is governed by the monad , which legalises “no answer”; the uniqueness axis by the monad, which legalises “several answers”. Their combination is the full relational reading, and is the quantitative refinement of , carrying weights instead of a bare subset.

References

  • M. Giry, A categorical approach to probability theory (1982)