Models built forward, for the measure theorist
Why an abstract probability space serves modelling as an abstract vector space serves linear algebra, why the way back to coordinates is harder in probability, and how building a model forward from densities restores it, so that every random variable factors through the quantities and every expectation is an explicit integral.
This note is for the reader who knows measure theory far better than statistics, and who wants to know what a probabilistic model is before being told how to compute with one. Its argument is an analogy with linear algebra, and its conclusion is that models built forward from densities sit in a corner of probability theory where the analogy is exact: one can reason abstractly and compute concretely, and move between the two without meeting the edge cases that usually make the move painful.
The abstraction, and the way back#
Linear algebra is done in an abstract vector space . A mathematician working there never says which coordinate of which holds which quantity of interest: vectors are added, subspaces are taken, linear maps are composed, and the dimension can be anything. When a computation is needed, a basis is chosen, becomes , and the abstract statements become statements about arrays of numbers. The way back is a single theorem: every finite-dimensional vector space is isomorphic to a coordinate space, and every choice of basis gives such an isomorphism.
Probability is done in an abstract probability space . A modeller working there never says what is, nor which sets are in , nor what assigns to them. Instead they introduce random variables , measurable maps into the spaces where the quantities of the model live, and speak only of those: their laws, their joint laws, the independence of one from another, the conditional law of one given another. Any number of them may be introduced, and new ones may be introduced later, provided the space is rich enough to carry them. The abstraction does for the modeller what does for the linear algebraist: it relieves them of a coordinate system they do not need.
The way back to coordinates is where the analogy usually breaks. Several things can go wrong at once:
The space is underdetermined. Many triples carry random variables with the same joint law, and may hold far more than the model ever mentions. Nothing in the model says which.
Conditioning needs regularity. The conditional law of given , for with values in and in , defined as a kernel , written and characterized by
(1)a regular conditional distribution, exists only under assumptions on the spaces (standard Borel is the usual one), and even then only up to null sets of ’s law. Conditioning on an event of probability zero, which is what observing a continuous quantity does, depends on which version is chosen; the Borel–Kolmogorov paradox is the classic example of two natural versions disagreeing.
Densities need a reference. A density is a Radon–Nikodym derivative, and exists only when the law is absolutely continuous with respect to a chosen measure. The law of a function of quantities, such as or a projection, often has none.
Existence needs a theorem. Writing down a family of random variables does not make a space that carries them. Kolmogorov’s extension theorem builds one from consistent finite-dimensional laws, but asks for topological regularity of the spaces to do so.
So the modeller who wants to compute, to write a probability as an integral and evaluate it, has to justify every step back from , and usually does not.
A corner of probability where the way back is clean#
Applied models are almost never as general as the theory allows. They are built from two ingredients, and both remove an edge case.
Seeds with densities. Every quantity lives in a space with a reference measure, a -finite measure against which its distributions are written as functions. The two examples to keep in mind are Lebesgue measure on (or an open subset of it, such as the positive orthant) and counting measure on a countable set, which may itself sit inside a vector space, such as the integers. Every distribution a quantity is drawn from is absolutely continuous with respect to its reference measure, so it is given by a function.
Let be a -finite measure on a measurable space , and a finite measure on it with , that is, implies . Then there is a measurable with
and any two such functions agree -almost everywhere. One writes and .
With respect to Lebesgue measure, is a probability density function: , its values are not probabilities, every single point has measure zero, and is determined only up to a Lebesgue-null set. With respect to counting measure, nothing is null but the empty set, and the density is pinned down completely by the mass it gives to points.
Let be countable, with every subset measurable, and let be counting measure. Every probability measure on is absolutely continuous with respect to , its density is unique, and it is
If then , so , and is -finite because is countable. Countable additivity gives with , and uniqueness almost everywhere is uniqueness everywhere, since the only null set is empty.
∎This is why is called a probability mass function in that case, and why the two cases can be treated as one: a density is always with respect to a reference measure, and a mass function is a density with respect to counting measure.
Nothing in what follows needs these two in particular: a reference measure need only be -finite, for Theorem 2 and Tonelli’s theorem to apply, and Lebesgue measure and counting measure, and products of them, are examples, not the only choices. The choice is a modelling decision, though, and a good one makes the density values mean something. A density is a likelihood only relative to its reference measure: compares how much probability the model puts near with how much puts there. So the reference measure should be the one that is as uniform, or as uninformative, as the space allows: Lebesgue measure on a vector space, counting measure on a finite set, and in general the invariant measure of a symmetry the space has, or, loosely, the measure of maximal entropy. Then the factor contributes is the same everywhere, and a larger value of means, without correction, a more likely point. With a reference measure that is not uniform, the density absorbs the difference: it is larger where is small, and compares points by something other than their likelihood.
Quantities introduced one at a time. Each quantity is drawn from a distribution whose parameters may depend on any quantity introduced before it, through any measurable map, however nonlinear. A vehicle’s position is drawn given its previous position, pushed through a motion model; a range measurement is drawn given the vehicle and a landmark, through the distance between them.
A model built forward is a finite sequence of quantities , each with
- a space and a -finite reference measure on it: for instance Lebesgue measure on or on an open subset of it, or counting measure on a countable set; and
- a conditional density: a measurable function such that is a probability density with respect to for every .
Its joint density is , with respect to the product measure on , where is the product space and the product -algebra.
A conditional density written as , a family of densities with parameters computed from earlier quantities by a measurable map , is measurable as a composition of measurable maps, so any such nonlinear dependence is allowed. Nothing else is: there are no quantities without a density, and no dependence on a quantity introduced later.
What the restriction buys#
The first thing it buys is a canonical coordinate space, in the role of .
The measure is a probability measure on . For each , its marginal on the first quantities has density with respect to , and
is a version of , the regular conditional distribution of the -th quantity given the ones before it.
The function is non-negative and measurable on the product. By Tonelli’s theorem, integrating over first, then , and so on, each factor integrates to against whatever the earlier coordinates are, so , and stopping after the last integrals leaves the marginal density on the first . For measurable and , Tonelli again gives , with the marginal on the first , and is a probability measure for every and measurable in for every , again by Tonelli.
∎The probability space can then be taken to be the product space , and the quantities the coordinate projections from to ,
This is the analogue of choosing a basis: the quantities are the coordinates. Nothing is lost by the choice, because every statement the model makes is about the joint law of its quantities, and that law is on any space that carries them.
Nor is the restriction to finitely many quantities essential. The construction never used anything about the spaces beyond measurability, and it extends to infinitely many quantities built forward, with no topological assumption, by a theorem that is the right one for models built this way.
Let be any measurable spaces, a probability measure on , and for each let be a probability kernel from to . There is a unique probability measure on , with its product -algebra, whose marginal on every finite initial product is .
Kolmogorov’s theorem builds a law from consistent marginals, and needs the spaces to be nice for the marginals to determine one. Ionescu-Tulcea builds it from successive conditional laws, which is exactly what a model built forward provides, and needs nothing. Appending a quantity is extending a basis: the old coordinates keep their joint law, and a new one is added with its conditional law given them.
The second thing the restriction buys is a guarantee about what the model can say. A model speaks only of its quantities, so the random variables it can express are the -measurable ones, , and those are exactly the functions of the quantities. That is a lemma about any measurable map whatever, on any space, not only about the quantities.
Let be any measurable map from a measurable space to any measurable space , and . Then is -measurable if and only if for some measurable .
If , then for every Borel . Conversely, every set in is for some , so an indicator is , and by linearity every -measurable simple function is for a simple . A -measurable is a pointwise limit of such functions ; the set where converges is measurable, and there and elsewhere is measurable with , because the sequence converges at every point of the image of .
∎In a model built forward, apply it to the quantities taken together. On the product space, is the identity map, since and each is a coordinate projection. So : every event is an event about the quantities, every scalar-valued random variable on is -measurable, and by the lemma every one of them takes the form . On any other space that carries the quantities, may be larger than , but the random variables the model can express are still the -measurable ones, and the conclusion is the same.
Let a model built forward be carried by quantities on a probability space , so that has law . Every random variable the model can express, that is every -measurable one, is for a measurable , and when it is integrable,
The first claim is Lemma 7, with there the quantities here. For the second, the law of is , so by the change of variables for image measures, and because . The iterated form is Fubini’s theorem, which applies because is -integrable.
∎This is the probabilistic half of the analogy made precise. In linear algebra, a vector of is a combination of basis vectors and a linear functional is a combination of coordinates. Here, a random variable is a function of the quantities, an event of the model is a measurable set of their values, and its probability, an expectation, a marginal or a moment is an integral against the product of the conditional densities, in the order the model was built. The integral is explicit, though it is rarely available in closed form; estimating it is what inference algorithms are for.
Mapped values#
A model built forward carries more than its quantities. A mapped value , for a measurable , such as a distance between two positions, a predicted measurement, or the parameters of a later kernel, is a random variable of the model like any other, and by Lemma 7 every random variable the model can express is one.
A mapped value is a target, determined by the quantities, not a further source of randomness. Once the quantities are drawn or fixed at , it is computed, , and never drawn. So nothing about it needs to be sampled or weighed on its own account. Computing on draws of samples its law ; a weight attached to a draw is already the weight of the pair , since adds no randomness to it; and its expectations are those of Corollary 8 for the function :
Its law can be awkward (concentrated on a lower-dimensional set, for instance, with no density with respect to any reference measure), but nothing requires that density: a model’s densities are those of its quantities, and a mapped value enters them only as the argument of a later kernel or likelihood factor, through the quantities it is computed from.
Conditioning and likelihoods#
Observing quantities is conditioning on them, and in this corner it needs no existence theorem: the conditional law is written down from the densities.
Split the quantities of a model built forward into observed ones and free ones , and let
Then is a density of the law of , finite -almost everywhere, and the kernel
defined arbitrarily elsewhere, is a regular conditional distribution of given .
By Tonelli, is measurable and , so it is a density of the law of and is finite -almost everywhere. The set where it is has probability under that law, and so does the set where it is infinite. For measurable and ,
the two exceptional sets contributing nothing to either side, which is the defining property of a regular conditional distribution.
∎The version is chosen, not discovered: changing the densities on a null set, or the reference measures by a change of coordinates, changes on a null set of observations, which is all the freedom the Borel–Kolmogorov paradox exploits. In a model built forward the choice is made once, by the densities and reference measures the model was written with, and every observation is conditioned on by that same rule. That is also why two densities may only be compared, or divided, when they are with respect to the same reference measure.
The same computation explains a factor that scores no quantity. Multiplying the joint density by a non-negative function and normalizing is a change of measure, and it is always conditioning on data that the model does not carry as a quantity.
Let be measurable with . Then is a probability measure with density with respect to . If for a conditional density of a further quantity appended to the model, then is the conditional law of given , as conditioning by densities gives it.
is a probability measure because , and its density with respect to is . With appended, the joint density is , so Proposition 9, with free and observed at , gives the conditional density , where the marginal density of that statement is .
∎So a likelihood factor is exactly what its name says: the likelihood of an observation that is not a quantity of the model, already conditioned on.
Parameters and improper priors#
An improper prior, a “density” with infinite integral such as a flat density on a line, cannot be a seed, since it is not a probability measure. It is expressed instead by a parameter and a score. A parameter takes values in a space with a reference measure , like a quantity, but enters with no kernel: the model becomes a family , each of its kernels free to depend on measurably, as on any earlier quantity. A score is a likelihood factor on the parameter, for the flat prior. With observed, the model then describes
a -finite measure, which is a posterior, after normalizing, exactly when its total mass is finite and positive. Whether it is depends on what is observed: it is a condition on the query, not on the model. Either way, (11) is the objective of optimization, and maximizing is maximum a posteriori or, with , maximum likelihood estimation.
In every other respect a parameter is a quantity: it is a coordinate of the space the model describes, functions of it are random variables of the model, and it is conditioned on or left free like the rest. The one difference is that nothing generates it. An optimizer must be given its starting value, and a sampler must draw it from a proposal of its own, a density that may depend on earlier quantities like a kernel, and contributes in all to the weight.
Working with a model built forward#
A model built forward is not a function to be evaluated, but a probability space built quantity by quantity, and the measure theory above lets it be worked with in every way such a space allows, of which evaluating is only one.
Quantities are specified by their augmenting kernels. Each quantity enters the model with the kernel that augments the space built so far,
(12)the kernel of Proposition 5, so that the model is and appending a quantity is appending a kernel, as in Theorem 6. The kernel is a function of every quantity before it, but it need not depend on all of them, and it seldom does: most kernels read only a few, which is what the graphical representations below are about. Writing
says that the space is augmented by a new quantity with kernel . When the reference measure is canonical, or does not matter where it is written, is shortened to .
Likelihoods are built incrementally too. A likelihood factor may be added at any point, as a function of the quantities that exist when it is added, and the model’s likelihood is their product . The measure the model describes is then , normalized, by Proposition 10.
The model can be sampled, with weights. Drawing from the kernels in order samples . With observed, drawing the free quantities from their kernels, the observed ones held at their values, samples a measure that differs from the conditional law of Proposition 9, reweighted by , by the weight
(13)up to a constant: the likelihood of the observations and of the likelihood factors at the drawn point. What such a weighted draw estimates, and what a quantity drawn from something other than its own kernel adds to the weight, is the subject of a later note.
Parameters are quantities without a seed. An improper prior is a parameter with a score (11). Nothing generates a parameter, so a sampler draws it from a proposal and an optimizer is given its starting value, and in every other way it is treated as a quantity.
Mapped values live in the model. A mapped value is a value computed from its arguments: sampling them samples it, weighing them weighs it, its expectations are integrals by Corollary 8, and, most of all, later kernels may be parameterized by it. A kernel is written by building its parameters out of mapped values, composed as freely as any measurable map allows, and derivatives flow through them to the quantities they are built from.
Everything is a logarithm. Every product above becomes a sum once its logarithm is taken:
with one term for each kernel, likelihood factor and score. Sums suit what is done with them. A product of many densities underflows where a sum of their logarithms does not; the derivative of a sum is the sum of the derivatives of its terms, each reading only the few quantities it involves; and a normalizing constant becomes an additive constant, which every algorithm that ignores the normalization simply drops.
Graphical representations#
A quantity’s kernel seldom reads every quantity before it. It reads a few, its parents : the kernel is constant in the coordinates with and , and so is its density. This is written
which is an abuse of notation: the right-hand sides are not and but the maps they define once the coordinates in which they are constant are removed from their arguments. Read the other way, a statement , or , names the parents of the new quantity at once: .
A running example shows what is read off the parents. Five quantities are built as
and a likelihood factor is added. The quantities, with an edge from each parent to its child, form the model’s dependence graph. Its roots are the quantities with no parent, and it is acyclic, because every edge points forward in the order the model was built.
- Quantity
- is a parent of
The dependence graph shows how the quantities may be generated from one another through their kernels. An ancestral order is any order of the quantities in which every parent comes before its children. The order the model was built in is one, and there are usually others. Drawing the quantities in any ancestral order, each from its kernel, samples , since each kernel reads only quantities already drawn.
The dependence graph says nothing of the likelihood factors, nor of the terms of the joint density at all. The model’s probabilistic graph shows them. Its nodes are the quantities and the terms, the kernel densities and the likelihood factors, and it has an edge from each quantity to every term that reads it and from each kernel density to the quantity it is the density of.
- Quantity
- Kernel density
- Likelihood factor
- is read by
- is the density of
Whatever the model, the density of the measure it describes, before normalizing, is a product of its terms, each of the form or . Which term reads which quantity is then what matters, more than which quantity generated which: it says which factors of the joint density change when a quantity does. That is the probabilistic graph with its directions forgotten, the model’s factor graph, in which each term is joined to every quantity it involves.
- Quantity
- Kernel density
- Likelihood factor
- involves
The Markov blanket of a quantity is the set of other quantities that appear with it in some term: its parents, its children, the other parents of its children, and whatever a likelihood factor ties it to. Given its blanket, a quantity is conditionally independent of everything else. By Proposition 9 its conditional density given all the others is the joint density divided by a function of the others, and so is proportional, as a function of , to the product of the terms that read , which read nothing outside the blanket. Whatever is done to one quantity, whether it is resampled, optimized or integrated out, therefore touches only the terms that read it and concerns only its blanket. In the factor graph the blanket is the set of quantities two edges away: across each term that involves the quantity, to the other quantities that term involves.
- The quantity
- Its Markov blanket
- Quantity
- Kernel density
- Likelihood factor
- involves
Every model built forward has all three graphs, each a picture of it at a different level of abstraction: which quantity generates which, which term reads and scores which quantity, and which term involves which quantity. A model is commonly given by one of them.
Built on by
- Terms and the probabilistic graph A model's density is a sum of terms, each a log-density that scores one quantity or none; the terms and quantities together make the probabilistic graph inference reads, and a retirement removes some quantities, replaces their terms, and frees what it leaves needed by nothing.
- Densities in tangent charts A retraction's chart at a point carries the manifold's reference measure to a density on the tangent space, the chart's volume; with it, a random tangent vector pushed through the chart has a density on the manifold, given here for the charts of the rotations, the poses and the sphere.
- The normal distribution in a chart The normal on a manifold with a global chart is the law of a point moved from its mean by Gaussian noise through the chart; its density is the Gaussian's less the chart's log-volume, its sampler is exact, and its expected information has a closed form, exact on flat and positive spaces and in the scale's block on curved ones.
- Importance weights Drawing the free quantities of a model in an ancestral order, each from a proposal, and weighing the draw by the ratio of the model's density to the proposals', gives an unbiased estimate of every integral against the unnormalized conditional law, provided each ratio is of densities against one reference measure.
- Maximum a posteriori estimation The estimate this part of the mathematics computes is the mode of the posterior, the point at which the negative log-density of the free quantities at the observations is least; it needs no normalizer, it depends on the reference measure the density is taken against, and its objective is a sum of terms that each read a few quantities.
- Calibration of credible sets Data drawn from a model come with the truth that generated them, and that truth is a draw from the posterior; so a set holding posterior probability α contains the truth with probability α over such data, and an approximate posterior is checked by how often its sets do, against a tolerance that keeps sampling error apart from the approximation's own.
- Improper Gaussian replacements: Mathematics The improper Gaussian factor, a sum of squared affine rows of any number, a linear term and a constant in the stacked tangent of a retirement's blanket at constant anchors, which keeps what retired terms say about blanket quantities they do not determine, adds across retirements, and is the normal's Stacked replacement when it is of full rank.
- The core: Mathematics The mathematics the core rests on, from quantities, their charts and their products, through operations and their derivatives of first and second order composed over programs, to queries, terms, importance weights, random keys and retirement.