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.
Once a mode has been found, the question is how sure the answer is: the spread of the density around the mode, the spread of a few of its coordinates with the rest integrated out, the total mass under it. Each is an integral that has no closed form for anything but a Gaussian. A Laplace approximation replaces the density by a Gaussian fitted at a point, and reads the answers off the Gaussian. This note fits it from the linearization, says what each answer costs to compute, and measures what the fitted covariance leaves out when the space is curved.
Throughout, is the negative log-density (2) of a point of a product of manifolds, against the product of their reference measures, is the point of approximation, and is the stacked Jacobian of the residuals there.
The integral, in a chart#
The integrals in question are against , and a Gaussian lives on a vector space. The chart at connects them, and it brings its volume with it. By (3), for a chart that is full,
with the log-volume of the chart at . What is approximated by a Gaussian in is therefore the chart objective of (4), and not alone. Its linearization, the chart linearization, has the rows of the linearization of , with and in place of and . The difference shows in two places.
- The centre. The Gaussian is centred at when is a stationary point of the chart objective, where , and not of . On a Euclidean space . On a group whose chart translates the identity’s, as the Cayley chart of the rotations does, the log-volume is the same at every point and even in , as the stereographic chart’s of the sphere is, so its gradient at is zero: on these spaces the centre is a mode of . On a positive space in each coordinate, and the centre is the mode in the logarithmic chart. For a log-normal of median it is itself, where is centred, while the mode with respect to Lebesgue measure is , below it. A Gaussian in the tangent coordinates is a Gaussian in the logarithms, and is centred where they are.
- The constant. is on a positive space and zero where the reference measure is the one the retraction normalizes: the volume of the reference measure near .
What it gives#
When the rows of the chart linearization have full rank, is a constant times a normal density on , and everything asked of the approximation is a computation on the rows by elimination, with the triangular root the elimination leaves and the minimizer of .
| asked for | computed by |
|---|---|
| the mean, in the tangent at | the minimizer , zero at the centre |
| the covariance, and its marginal on some variables | partial elimination of the others (Corollary 13), and the triangular root of what is left on : |
| a draw | , with standard normal |
| the evidence | , by (12) |
No covariance matrix is formed for any of them. A marginal on one variable is a normal in the chart at that variable’s estimate, with a whitening of its own, and costs one partial elimination. A draw lies in the chart’s domain on every space whose chart is global. Where the chart is not global, the Gaussian’s mass outside its domain is an error of its own, apart from those below.
What the covariance leaves out#
The Gaussian’s precision is the rows’, . The Hessian of the chart objective at the centre is that and
the curvature of the residuals, of the terms’ log-volumes and of the chart’s log-volume: the part of (3) that the linearization omits, with the chart’s term added. For linear-Gaussian terms (Proposition 7), and the approximation is exact. Otherwise, on Euclidean and positive spaces, only the first sum remains, the curvature that every Gauss–Newton method leaves out. On a curved space all three parts are of the same order. Each is of order one, while is of the order of the terms’ precisions, so each changes the covariance by a relative amount of the order of the noise’s variance, .
- The chart’s part is positive. For the Cayley chart of the rotations and the stereographic chart of the sphere, the log-volume is , whose Hessian at zero is . So the chart adds on each such variable that is integrated over.
- The terms’ part is negative. Let be the derivative of a term’s tangent coordinate with respect to . The term’s log-volume adds about , against the that its rows keep: the replacement of by that a measurement on a curved space shows.
- The residuals’ part is not small, even at the mode. Along the retraction, the second derivative of is of first order in the residual. The first sum of (2) is therefore quadratic in the residuals, of order one like the others, and it vanishes only where the residuals do. For a rotation measured in the Cayley chart, it averages about over the noise, against the log-volume’s , as computed numerically from 4000 draws at .
The sign is not fixed. One covariance is smaller than another exactly when its precision is larger, and then every marginal of it is smaller too. So the rows’ covariance is smaller than the second-order covariance in every direction when is negative semidefinite, and larger in every direction when is positive semidefinite. Neither holds in general: the chart’s part is positive, the terms’ log-volumes negative, and the residuals’ part can be of either sign.
What a covariance is meant to describe, though, is the density itself, and the second-order approximation is itself in error on a curved space, at the same relative order . Two examples on the rotations, in the Cayley chart with an isotropic , show how the three covariances compare with the true one. Both were computed numerically: the true covariance in the chart at the mode by importance sampling, or exactly from the chain that generates it.
The first example is a rotation with a prior of fixed mean and measurements of it, approximated at the mode. The table gives the trace of each covariance divided by the true one, averaged over six data sets.
| rows | rows and log-volumes | full Hessian | ||
|---|---|---|---|---|
The rows are over-confident by about half of the that the log-volumes alone would predict. Adding the log-volumes’ curvature overshoots, to an under-confidence of about the same size, because the residuals’ curvature cancels about half of it. The full Hessian is close to the truth.
The second example is a chain: with a prior of fixed mean, and , with nothing observed. It is approximated at its mode, where every residual is zero. The residuals’ curvature therefore vanishes, and the rows with the log-volumes’ curvature are the full Hessian. The variance of , per axis, is as follows.
| rows | full Hessian | true | |
|---|---|---|---|
Both approximations are over-confident here, and the rows are the closer. They are exact on , where the full Hessian gives against at . The second-order approximation matches the curvature at the mode exactly, and that does not match the spread: the law is a Gaussian in the chart of and in that of the transition, and not in the joint chart at the mode.
So, on a curved variable:
- Confidence. Compared with the second-order approximation, the rows’ covariance may be over- or under-confident, depending on the direction. Compared with the truth, it was slightly over-confident in every case computed here: by to at rad and to at rad. No argument shows that it must be. On Euclidean and positive spaces with linear-Gaussian terms it is exact.
- Consistency. Adding the log-volumes’ curvature to a marginal is not the consistent choice. It adds one of three parts of the same order and leaves out the residuals’, which in the first example cancels about half of it. Added on the kept variables alone, it also leaves out the curvature on the eliminated ones, which reaches the marginal through their conditionals. To first order in , the marginal precision on changes by , not by , where lifts a tangent vector on to the whole tangent by the conditionals of the eliminated variables , with the right-hand sides set to zero: with in blocks, . The consistent second-order approximation is the full Hessian. It needs second derivatives, it can be indefinite, and in the second example it is no closer to the truth.
- Definiteness. The rows’ precision is positive definite whenever the rows determine every direction. With the log-volumes’ curvature, the terms’ and the chart’s parts sum to about on the curved blocks, which is positive definite whenever every is, that is, when every curved term’s noise is less than one in its chart’s coordinates. This is the condition under which a normal’s mean is a mode of its density. Definiteness is lost only where the normals themselves are broad, and the residuals’ part can still move this boundary.
The rows’ precision is thus a sum of squares, positive definite by construction, obtained from first derivatives and one elimination, and in error on a curved variable by a relative amount of order . Adding part of the omitted curvature buys no consistency that the rows lack, and the full second-order approximation is not reliably closer. A covariance of a curved variable reported from the rows should be reported with the order of its error.
A marginal kept as a Gaussian#
Integrating variables out by elimination of the linearization leaves an improper Gaussian factor on the variables that remain, by what elimination leaves, anchored at the point of linearization. For linear-Gaussian terms it is the exact marginal. Otherwise it approximates the logarithm of the marginal density, and it differs from the marginal of a Laplace approximation in two ways. The chart’s part of (2) is there only for the variables integrated over, so nothing offsets the terms’ log-volumes on the variables kept. And the factor is a function on the manifold, not a Gaussian in a chart of it, so whoever integrates against it later applies the chart’s volume to it again.
The chain of the second example shows both, read as integrating out and keeping . The exact factor is the logarithm of the marginal density of , whose curvature at the anchor was computed numerically from draws of . These are precisions per axis.
| rows | with (2) | with (2) and the log-determinant | exact | |
|---|---|---|---|---|
The rows are over-confident at the anchor, by at and at . The second-order Schur complement overshoots, by about as much, the other way. The exact curvature needs one more term: how the log-determinant of the eliminated block’s Hessian varies with the variables kept, the correction of Laplace’s method of the next order.
The larger cost lies elsewhere. The exact marginal is not a Gaussian in the anchor’s chart, whatever its curvature, and the departure is of the order of the marginal’s own variance. With the exact curvature, the factor alone gives the variance per axis, against the of the exact marginal at , and against at . A filter that predicts without measuring integrates one state out after another, and its factor’s variance grows. Its error grows with it. At , after such steps along the chain, the variance that the factor gives the newest state, divided by the exact one, is as follows.
| rows | |||||
| with (2) |
This is the over-confidence of an extended Kalman filter on a curved state. It is a cost of keeping a marginal as a Gaussian in one chart, and not of the omitted curvature: adding the curvature makes it worse after the first step. Measurements bound the factor’s variance, and with it this error.
Built on by
- Linearization and elimination A density query is linearized at a batch of points into factored least-squares problems over its free quantities, by its residuals or by its information roots, and each problem is eliminated in square-root form on the host into a step, marginals, an evidence, draws, or a retirement's replacement; the Levenberg–Marquardt method iterates the steps to the mode.
- 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.
- Optimization and estimation, term by term The notes on least squares and Gaussian approximations name most things twice, once as an optimizer would and once as a state estimator would; this table sets the two names side by side, row by row, with the note that defines each.