skoro v0.0.0

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.

Updated 2026-11-25 · 4 min read

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#

Definition 1(The maximum a posteriori estimate).

Let a model built forward have free quantities FF and observed ones OO, observed at xO\point_O, with the joint density p\density against the product ν=νF⊗νO\nu = \nu_F \otimes \nu_O of reference measures, and let 0<pO(xO)<∞0 < \density_O(\point_O) < \infty. The objective is the negative logarithm of the joint density at the observations,

f(xF)=−log⁡p(xF,xO), f(\point_F) = -\log \density(\point_F, \point_O) ,

and a maximum a posteriori estimate, or mode of the posterior, is a point x^F\hat \point_F at which ff is least: f(x^F)≤f(xF)f(\hat \point_F) \le f(\point_F) for every xF\point_F. A local mode is a point at which ff 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 νF\nu_F is p(xF,xO)/pO(xO)\density(\point_F, \point_O) / \density_O(\point_O), and the denominator does not depend on xF\point_F. So

−log⁡pF∣O(xF∣xO)=f(xF)+log⁡pO(xO),(2) -\log \density_{F \mid O}(\point_F \mid \point_O) = f(\point_F) + \log \density_O(\point_O) , \tag{2}
(2)

and the mode is found without the normalizer pO\density_O, 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 S(θ) pθ(xF,xO)S(\theta)\, \density_\theta(\point_F, \point_O). Its objective is the negative logarithm of that, −log⁡S(θ)−log⁡pθ(xF,xO)-\log S(\theta) - \log \density_\theta(\point_F, \point_O), and its minimizer is a maximum a posteriori estimate when the measure is a posterior and a maximum likelihood estimate of θ\theta when S≡1S \equiv 1. 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 ff 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.

Proposition 3(A change of measure moves the mode).

Let νF′=h νF\nu_F' = h\, \nu_F for a positive measurable function hh of the free quantities. The posterior is the same law against either measure, its density against νF′\nu_F' is its density against νF\nu_F divided by hh, and the objective against νF′\nu_F' is

f′(xF)=f(xF)+log⁡h(xF). f'(\point_F) = f(\point_F) + \log h(\point_F) .

The two objectives differ by log⁡h\log h: when hh is constant they have the same minimizers, and when it is not they have, in general, different ones.

Proof.

For measurable AA, ∫A(pF∣O/h) dνF′=∫ApF∣O dνF\int_A (\density_{F \mid O} / h)\, \dd \nu_F' = \int_A \density_{F \mid O}\, \dd \nu_F, so pF∣O/h\density_{F \mid O} / h is the posterior’s density against νF′\nu_F', and taking the negative logarithm of the joint density divided by hh gives f′f'.

∎

This is not a change of variables. An optimizer that writes ff 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 x\randomPoint be log-normal, log⁡x∼N(m,s2)\log \randomPoint \sim \mathcal N(m, s^2). Against Lebesgue measure its density is 1xN(log⁡x; m,s2)\frac{1}{\point} \mathcal N(\log \point;\, m, s^2), and its objective log⁡x+(log⁡x−m)2/2s2\log \point + (\log \point - m)^2 / 2 s^2, up to a constant, is least at x=em−s2\point = e^{m - s^2}. Against the measure dx/x\dd \point / \point, h(x)=1/xh(\point) = 1/\point, the objective loses the log⁡x\log \point, and the mode is eme^m, the median. Both are the mode of the same law. At s=1s = 1 they differ by a factor of ee.

In a chart. The chart at a point μ\mu carries the reference measure to a measure on its coordinates, and by (3) the density of the coordinate v\tangent of μ⊕v\mu \oplus \tangent against Lebesgue measure is the density of the point times eλμ(v)e^{\lambda_\mu(\tangent)}. Its objective is the chart objective

f(μ⊕v)−λμ(v),(4) f(\mu \oplus \tangent) - \lambda_\mu(\tangent) , \tag{4}
(4)

whose minimizer is the image of a mode of ff only where the log-volume λμ\lambda_\mu is constant in v\tangent 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 ff 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,

f(xF)=∑tϕt(xF),(5) f(\point_F) = \sum_t \phi_t(\point_F) , \tag{5}
(5)

one term ϕt\phi_t 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 KtK_t, 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 ff 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