nLab sampling map

Contents

Context

Measure and probability theory

Constructivism, Realizability, Computability

Computation

Contents

Idea

A sampling map is an assignment that takes a probability distribution pp on a space XX, and returns a random sample from XX distributed according to pp.

It is a mathematical abstraction of the idea of flipping a coin, or of rolling a die (which are fair, or for which we know the bias): the outcome is random, but we know exactly the distribution it follows.

In measure-theoretic probability

Let XX be a measurable space. Denote by PXP X the set of probability measures over XX. The sampling map is the Markov kernel samp:PXXsamp:P X\to X defined for every pPXp\in P X and every measurable AXA\subseteq X by

samp(A|p)p(A). samp(A|p) \;\coloneqq\; p(A) .

We can interpret this kernel as of “taking a sample from the distribution pp”.

Example

Given a number b[0,1]b\in[0,1], a Bernoulli random variable with bias bb, denoted by Bern(b)Bern(b), is a random variable which is 11 with probability bb, and 00 with probability 1b1-b. (Intuitively, we are “flipping a coin with bias bb”.)

We can view the set [0,1][0,1] as parametrizing all the possible probability distributions on {0,1}\{0,1\}, i.e. [0,1]P{0,1}[0,1]\cong P\{0,1\}. Therefore, the assignment BernBern induces a Markov kernel P{0,1}{0,1}P\{0,1\}\to\{0,1\}, which is exactly the sampling map given above.

In terms of the Giry monad

The sampling map is the counit of the adjunction induced by the Giry monad between the category of Markov kernels and the category of measurable spaces.

As the counit of an adjunction, it satisfies the following universal property: every Markov kernel XYX\to Y can be written as a composition XPYYX\to P Y\to Y, where the map XPYX\to P Y is deterministic (it is the kernel induced by a measurable function), and the map PYYP Y\to Y is the sampling map.

A probabilistic interpretation of this universal property is that sampling generates all the randomness. In other words, a process is random if and only if, at some point, it involves sampling, for example flipping a coin, or something analogous.

This is particularly important in probabilistic programming (see below).

In Markov categories

(For now, see representable Markov category.)

In computer science

In terms of thunk-force categories

As the counit of a Kleisli adjunction, the sampling map can be interpreted as the forcing map of a thunk-force category.

One can view a probability distribution as a thunk, from which one can sample (or force) at a later time (for example, in lazy programming languages).

Part of the correspondence between the Markov category formalism and the thunk-force formalism is studied in Moss-Perrone’22.

In probabilistic programming

In probabilistic programming?, the sampling map is the function, usually denoted by samp, sample, or sometimes random, which returns a (pseudo)random sample from a specified distribution. (Often, the uniform distribution on the unit interval, or an approximation thereof.)

The sampling map, by its universal property, can be seen as “generating” the randomness of probabilistic computations. For this reason, categorical probability can be interpreted as a form of probabilistic programming semantics. (Another central aspect of categorical probability and of probabilistic programming, besides sampling, is conditioning.)

See also

References

category: probability

Created on July 11, 2024 at 16:46:50. See the history of this page for a list of all contributions to it.