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.
Once quantities are observed, a model built forward describes the free ones by their posterior, the conditional law of Proposition 9. The posterior is a whole law. Its expectations are integrals over every free quantity at once, and have a closed form for almost no model. What can always be asked of it is where its density is greatest. That point is the estimate this part of the mathematics computes, and the Gaussian approximations later in the part are fitted around it. This note defines it, says why it is the first thing to compute, and shows the one property of it that is easy to forget: it depends on the measure its density is taken against.
The objective and its minimum#
Let a model built forward have free quantities and observed ones , observed at , with the joint density against the product of reference measures, and let . The objective is the negative logarithm of the joint density at the observations,
and a maximum a posteriori estimate, or mode of the posterior, is a point at which is least: for every . A local mode is a point at which is least among the points near it.
The objective is the negative logarithm of the posterior’s density, up to a constant. By Proposition 9 the posterior’s density against is , and the denominator does not depend on . So
and the mode is found without the normalizer , an integral over every free quantity that is as hard to compute as the expectations themselves. That is why the mode comes first: it needs the joint density alone, evaluated at points, and its derivatives.
A model with parameters describes the measure (11), whose density is . Its objective is the negative logarithm of that, , and its minimizer is a maximum a posteriori estimate when the measure is a posterior and a maximum likelihood estimate of when . The two are the same computation, and nothing below distinguishes them.
A mode need not exist, nor be unique. A density that grows without bound toward the edge of its space has no mode, a symmetric one may have several, and a posterior that is not concentrated has modes that say little about where its mass is. The notes that follow find local modes, points where the chart gradient of vanishes and its curvature is positive, and say what can be read off one.
A mode depends on the measure#
A density is a density against a reference measure, and so is its mode.
Let for a positive measurable function of the free quantities. The posterior is the same law against either measure, its density against is its density against divided by , and the objective against is
The two objectives differ by : when is constant they have the same minimizers, and when it is not they have, in general, different ones.
For measurable , , so is the posterior’s density against , and taking the negative logarithm of the joint density divided by gives .
∎This is not a change of variables. An optimizer that writes in other coordinates moves its minimizer with the coordinates, and finds the same point. A change of measure changes the function, and the point. The posterior does not move: the same law, the same expectations, the same credible sets. Only its density changes, and with it the point at which the density is greatest. The mode is a property of the pair of a law and a reference measure, and not of the law alone.
The positive reals. Let be log-normal, . Against Lebesgue measure its density is , and its objective , up to a constant, is least at . Against the measure , , the objective loses the , and the mode is , the median. Both are the mode of the same law. At they differ by a factor of .
In a chart. The chart at a point carries the reference measure to a measure on its coordinates, and by (3) the density of the coordinate of against Lebesgue measure is the density of the point times . Its objective is the chart objective
whose minimizer is the image of a mode of only where the log-volume is constant in or its gradient vanishes there. On a Euclidean space it is zero. On a curved space it is not, and a mode read in a chart’s coordinates is not the mode against the space’s measure. A method that works in charts, as every method of this part does, says which of the two it computes: the steps of the next notes minimize and read its derivatives in charts, so they find a mode against the space’s own measure, and a Gaussian fitted in a chart is fitted to (4).
The objective is a sum of terms#
The joint density of a model built forward is a product of its kernels’ densities, its likelihood factors and its scores, so its objective is a sum,
one term for each kernel, factor and score, as the logarithms of a model are. Each term reads only the few quantities its kernel reads, its variables , and the observed quantities are held at their values. The term of a free quantity’s own kernel is its prior, and an optimizer would call it a regularizer, a penalty on the variables; the terms of observed quantities are the likelihood, which an optimizer calls the cost of the fit. So the gradient of is a sum of gradients that are each zero outside the coordinates of a few quantities, and its Hessian a sum of blocks, each on the variables of one term. Two quantities that share no term have a zero block between them. The methods that find a mode inherit this structure, and the factorization that ends this part’s linear algebra is built around it.
Built on by
- Models of normals as least squares When every term of a model is a normal with a fixed scale and a mean computed from other quantities, its negative log-density is half a sum of squared whitened residuals plus the charts' log-volumes and a constant, so its mode is a nonlinear least-squares problem; a scale that is estimated breaks the form.
- The Laplace approximation A Laplace approximation replaces a density near a point by a Gaussian in the chart there; taken in a chart it approximates the density times the chart's volume, its mean, marginals, draws and evidence are computations on the linearization's rows, and its covariance omits curvature of the order of the noise's variance on a curved space.